Operate the WEB application using Selenium VBA
I want to click on a search button
The code for that button
Both this class = "A" and TEXT →'search'
Use (to avoid duplication with other elements when class = "A" and'search'are specified alone)
.FindElementByXPath (○○) .Click
I want to operate, but how should I fill in ○○?
I would appreciate it if you could teach me.
In addition, because we are beginners, there are misuses in the usage of terms.
If so, please forgive me.
Answer # 1
Selenium has a FindElement 〇〇 method and a FindElements 〇〇 method.
FindElement 〇〇 returns only the first element found,
The FindElements 〇〇 method returns a collection of relevant elements.
You can use FindElements to rotate the collection with For each and click when the corresponding text matches.
Dim elm As Selenium.WebElement For Each elm In Driver.FindElementsByClass ("A") If elm.Text = "Search" Then elm.Click Exit For End If Next
Answer # 2
As it is
"// span [@ class ='A' and text () ='search']"
If the text contains spaces, use the appropriate function.
Answer # 3
It may be extra care, but if you haven't considered it yet, try Cypress, which is made by Google.
Selenium has various pitfalls, but Hama Cypress is very comfortable because it has been devised so as not to get hooked.
- ruby - even if you specify an element with xpath, you may or may not be able to get it
- i want to get the xml element of the following asahi shimbun url with vba
- python - how to get data from model class by specifying specific value from query set
- unable to get information from xpath with vba [scraping]
- python - how to determine whether xpath element exists in selenium
- vba - to end the original sub with the method created in the class module
- error when specifying cell of another workbook in vba
- vba - i want to know the xpath of the execute button
- i want to save an email by specifying an account with vba
- i want to judge whether the table element of the web screen is a tag with vba
- python - how to get by specifying td element
- vba - i want to add item by looping from database class to combobox
- python - specifying xpath with selenium
- vba - i want to create a member to use as an argument in my own class
- about specifying python element, 
- python selenium: can't find element with xpath
- reactjs - i want to assign a class only to the parent li element of the element clicked in react
- chrome - how to get the xpath of an element that is not displayed unless you hover over it
- python - scraping: element identification when there is no class/id name
- vba - how to use parent when specifying elements with selenium
- [vba] i don't know how to log in automatically from the next time [keep login]
- python - i can't get the element with selenium
- [vba] i get an "element not found" error when web scraping with selenium
- python selenium data extraction error
- please tell me how to select the vba selenium drop-down list