If you want to get an element with multiple classes in Selenium
↓ There are multiple classes as shown in the example.
Multiple classes
<ul class="topic-path under-menu-title">
Because it's a class find_element_by_class_name FindElementByClass I'm wondering if I'm going to use CSS functions.
For SeleniumBasic VBA
↓ It is assumed that the Selenium Basic driver has already been set for the driver.
An example of getting an element in a and displaying a string.
Dim a as WEbelement
set a = driver.FindElementByCss(".topic-path.under-menu-title")
Debug.print(a.Text)← The text of the element is displayed.
For Selenium Python
↓ It is assumed that the Selenium driver has already been set for the driver.
An example of getting an element in a and displaying a string.
a = driver.find_element_by_class_name(".topic-path.under-menu-title")
print(a.text)
CSS-coded popup buttons, etc. Often things that don't work with xpath or class work well with CSS. So when things go wrong Try all xpath, class, css.
Recommended Posts