From this page:
https://permits.losgatosca.gov/CitizenAccess/default.aspx
I'm trying to push the 'Search Permits' button under Building Permits.
This is its xpath:
//*[@id="ctl00_PlaceHolderMain_TabDataList_TabsDataList_ctl01_LinksDataList_ctl00_LinkItemUrl"]/span
This is the code I'm using:
url = "https://permits.losgatosca.gov/CitizenAccess/default.aspx"
driver_1 = webdriver.Firefox()
driver_1.get(url)
NEXT_BUTTON_XPATH = '//*[@id="ctl00_PlaceHolderMain_TabDataList_TabsDataList_ctl01_LinksDataList_ctl00_LinkItemUrl"]/span'
# "//*[@id="ctl00_PlaceHolderMain_TabDataList_TabsDataList_ctl01_LinksDataList_ctl00_LinkItemUrl"]/span"
button = driver_1.find_element_by_xpath(NEXT_BUTTON_XPATH)
button.click()
But I get this message:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"ctl00_PlaceHolderMain_TabDataList_TabsDataList_ctl01_LinksDataList_ctl00_LinkItemUrl\"]/span"} Stacktrace:
id="span_link_0"or#span_link_0- dot.Pyframe.. you need to switch that frame first than go to find element likedriver_1.switch_to_frame("ACAFrame")- Saurabh Gaur