Unable to locate element using selenium webdriver in python

后端 未结 2 1827
醉酒成梦
醉酒成梦 2021-01-19 17:34

I want to do some automation testing on a website called http://elegalix.allahabadhighcourt.in. I am using the following python code to click a button called \"Advanced\" on

2条回答
  •  不知归路
    2021-01-19 17:50

    It's because the element you are looking for is inside a frame, switch to the frame first and then search for the element

    from selenium import webdriver
    driver = webdriver.Chrome('./chromedriver')
    driver.get('http://elegalix.allahabadhighcourt.in')
    driver.set_page_load_timeout(20)
    driver.maximize_window()
    driver.switch_to.frame(driver.find_element_by_name('sidebarmenu'))
    driver.find_element_by_xpath("//input[@value='Advanced']").click()
    driver.switch_to.default_content()
    

提交回复
热议问题