使用selinium获取错误查找页面加载时间

时间:2017-02-22 05:53:29

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

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

1 个答案:

答案 0 :(得分:0)

以下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);**