<button class="button" style="styles">TEXT</button>
How do I find this element in a website using Selenium PhantomJS?
<button class="button" style="styles">TEXT</button>
How do I find this element in a website using Selenium PhantomJS?
You can use the XPATH, ro the element you want to find by using:
from selenium.webdriver.common.by import By
myButton = driver.find_element(By.XPATH, '//button[text()="Some text"]')
But using the XPATH is not the best practice sinze it can change if the html changes.
Other way to lacate it is using the tag "button":
myButton = driver.find_element_by_tag_name('button')
or the class:
myButton = driver.find_element_by_class_name('button')
There are several ways to find it, you can check them here: