2017-10-21 47 views

回答

0

如果你看一下源代碼

POLL_FREQUENCY = 0.5 # How long to sleep inbetween calls to the method 
IGNORED_EXCEPTIONS = (NoSuchElementException,) # exceptions ignored during calls to the method 


class WebDriverWait(object): 
    def __init__(self, driver, timeout, poll_frequency=POLL_FREQUENCY, ignored_exceptions=None): 

所以你需要設置poll_frequency參數

+0

非常感謝,非常快!我會玩這個。非常感謝塔倫。 –

+0

@TomasWooller,既然你是新人,只是想讓你知道,你應該標記答案,幫助你解決問題作爲一個公認的答案。這可以通過點擊upvotes附近的勾號按鈕來完成。你也可以做一次upvotes欣賞答案。這對任何人的問題和答案都是有效的 –

0

你在你的問題中提到了關於蟒蛇WebDriverWaitExplicit Wait和需要檢查webdriverwait更快。

documentationWebDriverWait提及如下:

class selenium.webdriver.support.wait.WebDriverWait(driver, timeout, poll_frequency=0.5, ignored_exceptions=None) 

其中:

  • poll_frequency - 調用默認之間睡眠間隔,它爲0.5秒

所以爲了修改WebDriverWait,使其速度更快,我們可以從0.5默認設置減少poll_frequency0.40.30.20.1等值按我們需求。