Advertisement

Selenium automation time-out configuration

阅读量:

#设定超时机制,例如在访问境外网站时若出现加载超时情况,系统将自动执行后续操作
driver.set_page_load_timeout(4)

复制代码
    import unittest
    import time
    from selenium import webdriver
    from selenium.webdriver import ActionChains
    from selenium.common.exceptions import TimeoutException
    from selenium.webdriver.common.keys import Keys
    
    
    class setPageLoadTime(unittest.TestCase):
    def setUp(self):
        # 启动ie浏览器
        self.driver = webdriver.Ie(executable_path = "g:\ IEDriverServer")
    
    def test_PageLoadTime(self):
        # 设定页面加载限制时间为4秒
        self.driver.set_page_load_timeout(4)
        s

全部评论 (0)

还没有任何评论哟~