第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在 python 中的 Selenium 中使用顯式等待時(shí)總是出現(xiàn) TimeoutException

在 python 中的 Selenium 中使用顯式等待時(shí)總是出現(xiàn) TimeoutException

慕后森 2022-10-11 21:22:48
我有下面的代碼。from selenium import  webdriverimport timefrom selenium.webdriver.support.ui import Selectfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Bydriver = webdriver.Chrome() #driver.implicitly_wait(10) #https://blog.csdn.net/u010895119/article/details/77005886driver.get('http://www.aim.env.uea.ac.uk/aim/model4/model4d.php') #button = driver.find_element_by_id('add_organic')#button.click()#input = driver.find_element_by_id("selection_box_id")#input.click()driver.find_element_by_xpath('//*[@id="selection_box_id"]/option[3]').click() #driver.find_element_by_xpath('//*[@id="selection_box_div"]/p/input').click()#input = driver.find_element_by_id("selection_box_id")#input.click()driver.find_element_by_xpath('//*[@id="selection_box_id"]/option[7]').click()#driver.find_element_by_xpath('//*[@id="selection_box_div"]/p/input').click()# driver.find_element_by_xpath('//*[@id="BacktoCalculation_id"]').click() ##driver.execute_script("window.history.go(-1)") #https://stackoverflow.com/questions/27626783/python-selenium-browser-driver-backwait = WebDriverWait(driver, 10) # element = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="mainForm"]/div[2]/table/tbody/|tr/td[3]/input')))# element.click()我總是遇到超時(shí)錯(cuò)誤:raise TimeoutException(message, screen, stacktrace)selenium.common.exceptions.TimeoutException: Message:但是當(dāng)我嘗試直接找到元素時(shí),它確實(shí)有效。但我需要在這里明確等待以確保安全。任何人都可以幫助找出上面代碼中的問(wèn)題嗎?非常感謝!element = driver.find_element_by_xpath('//*[@id="mainForm"]/div[2]/table/tbody/tr/td[3]/input')
查看完整描述

1 回答

?
慕桂英3389331

TA貢獻(xiàn)2036條經(jīng)驗(yàn) 獲得超8個(gè)贊

這是因?yàn)槟?xpath 中有錯(cuò)字


'//*[@id="mainForm"]/div[2]/table/tbody/|tr/td[3]/input' # error

'//*[@id="mainForm"]/div[2]/table/tbody/tr/td[3]/input'  # ok

這工作正常


wait = WebDriverWait(driver, 10) #

element = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="mainForm"]/div[2]/table/tbody/tr/td[3]/input')))#

element.click()


查看完整回答
反對(duì) 回復(fù) 2022-10-11
  • 1 回答
  • 0 關(guān)注
  • 199 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)