嗨我试图找到并单击该元素,但它不工作。 HTML代码的下面无法通过ID点击元素,python selenium
<a href="#" class="button blue block" id="tollstation">Toll Plaza(s) Between Two Stations </a>
我想如下
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'tollstation')))
等一个
element = driver.find_element_by_id('tollstation') element.click()
,但它不工作。 PLZ帮助..
是tollstation id是唯一的吗? ..有任何帧出现在DOM –
您确定该页面正在加载? – dhdavvie
是正在加载页面, 这里是我的代码 'path_to_chromedriver = 'C:/用户/黄芪多糖/桌面/ WebScrap /硒/ chromedriver' 浏览器= webdriver.Chrome(executable_path = path_to_chromedriver) URL =“HTTP ://tis.nhai.gov.in/tollplazasonmap语言= EN ' browser.get(URL) 元素= driver.find_element_by_id( 'tollstation') element.click() 在element2 = driver.find_element_by_class_name(' 按钮绿色 ') driver.find_element_by_id(' txtfrom ')。send_keys( “德里”) driver.find_element_by_id(' txtto')。send_keys( “班加罗尔”) element2.click() driver.implicitly_wait(1 0)' – Prashant