The html text below exits on a page. I am trying to have selenium click the button that this tag is referring to. I can not search this href because the id for given app is unknown and link will always have a different id. I have to click on this button by locating it by text inside button which is "New Database/Server"
<a data-turbo-frame="modal" href="/repo/servers/new?repo_application_id=280"><svg height="24" role="img" width="24"><use href="#icon_database-plus"></use></svg><span >New Database/Server</span></a>
How do I have the driver go to this href link?
CodePudding user response:
Use following xpath
to click on the button.
driver.find_element(By.XPATH, "//a[.//span[text()='New Database/Server']]").click()
or use link_text
driver.find_element(By.LINK_TEXT, "New Database/Server").click()