Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Method. By, ToSelector #35

Open
ghost opened this issue Oct 23, 2021 · 0 comments
Open

Modify Method. By, ToSelector #35

ghost opened this issue Oct 23, 2021 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 23, 2021

FindElement, FindElementsで、XPath、LinkText、PartialLinkText を指定可能にした。
※TinySeleniumVBA v0.1.0 に対しては、XPath、LinkText、PartialLinkText が追加になる。
※TinySeleniumVBA v0.1.1 に対しては、LinkText、PartialLinkText が追加になる。

TinySeleniumVBA WebDriver.cls

Public Enum By
    ID = 0
    TagName = 1
    ClassName = 2
    Name = 3
    CssSelector = 4
    XPath = 5                   '2021/7/15 add ishi
    LinkText = 6                '2021/7/15 add ishi
    PartialLinkText = 7         '2021/7/15 add ishi
End Enum
' by* to CSS selector           '2021/7/15 chg ishi
Private Function ToSelector(by_ As By, _
                            ByVal value As String) As Dictionary
    Dim Data As New Dictionary
    Select Case by_
    Case By.ID
        Data.Add "using", "css selector"
        Data.Add "value", "[id=""" + value + """]"
    Case By.TagName
        Data.Add "using", "css selector"
        Data.Add "value", value
    Case By.ClassName
        Data.Add "using", "css selector"
        Data.Add "value", "." + value
    Case By.Name
        Data.Add "using", "css selector"
        Data.Add "value", "[name=""" + value + """]"
    Case By.CssSelector
        Data.Add "using", "css selector"
        Data.Add "value", value
    Case By.XPath
        Data.Add "using", "xpath"
        Data.Add "value", value
    Case By.LinkText
        Data.Add "using", "link text"
        Data.Add "value", value
    Case By.PartialLinkText
        Data.Add "using", "partial link text"
        Data.Add "value", value
    Case Else
        Data.Add "using", "css selector"
        Data.Add "value", value
    End Select
    
    Set ToSelector = Data
End Function
@ghost ghost changed the title Modify Method. ToSelector Modify Method. By, ToSelector Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant