【问题标题】:finding page load time using selinium getting error使用 selenium 查找页面加载时间获取错误
【发布时间】:2017-02-22 05:53:29
【问题描述】:
Traceback (most recent call last):
  File "seli.py", line 7, in <module>
    browser = webdriver.Firefox(firefox_binary=binary)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 140, in __init__
    self.service.start()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

【问题讨论】:

    标签: python-2.7 selenium selenium-webdriver selenium-ide


    【解决方案1】:

    遵循 Selenium Java 代码可能会帮助您找到加载页面的时间 -

    **long start = System.currentTimeMillis();
    driver.get("Some url");
    long finish = System.currentTimeMillis();
    long totalTime = finish - start; 
    System.out.println("Total Time for page load - "+totalTime);**
    

    如果这不起作用,那么您将不得不等到页面上显示某些元素 -

    **long start = System.currentTimeMillis();
    driver.get("Some url");
    WebElement WE = driver.findElement(By.id("ID of some element on the page which will load"));
    long finish = System.currentTimeMillis();
    long totalTime = finish - start; 
    System.out.println("Total Time for page load - "+totalTime);**
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-24
      • 2021-09-22
      • 2014-08-27
      • 2020-08-02
      • 1970-01-01
      • 2018-11-04
      • 1970-01-01
      相关资源
      最近更新 更多