嗨我試圖找到並單擊該元素,但它不工作。 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