OS:Ubuntu 14,FF61,geckodriver 0.21.0,python2.7
我的脚本基本上看起来像
display = Display(visible=0, size=(800, 600))
display.start()
browser = wd.Firefox()
try:
browser.get(url)
ui.WebDriverWait(browser, 10).until(lambda x: len(x.title) > 1)
except Exception as e:
print str(e)
browser.save_screenshot(img_folder + camid + ".png")
print "get icon type error: " + url
browser.quit()
使用Jenkins随机触发这种样式的多个脚本(很难说出确切的频率是多少),我在“ browser.save_screenshot”,“ browser.quit()”和“ browser = wd.Firefox”中遇到了异常。 ()”。对我来说,这没有任何意义,因为它们每个都可以成功执行。当多个脚本一起运行时,肯定出了点问题。这些脚本可能共享相同的输入,但永远不会写入同一文件。或者一个脚本可以用不同的输入触发两次。
Traceback (most recent call last):
File "orgDaily.py", line 30, in <module>
browser.save_screenshot(img_folder + camid + ".png")
File "/home/work/env/local/lib/python2.7/site-
packages/selenium/webdriver/remote/webdriver.py", line 1031, in save_screenshot
return self.get_screenshot_as_file(filename)
File "/home/work/env/local/lib/python2.7/site-
packages/selenium/webdriver/remote/webdriver.py", line 1008, in
get_screenshot_as_file
png = self.get_screenshot_as_png()
File "/home/work/env/local/lib/python2.7/site-
packages/selenium/webdriver/remote/webdriver.py", line 1040, in
get_screenshot_as_png
return base64.b64decode(self.get_screenshot_as_base64().encode('ascii'))
File "/home/work/env/local/lib/python2.7/sitepackages/selenium/webdriver/remote/webdriver.py", line 1050, in get_screenshot_as_base64
return self.execute(Command.SCREENSHOT)['value']
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: Tried to run command without establishing a connection
或
Traceback (most recent call last):
File "orgDaily.py", line 30, in <module>
output = xzharrow.main(query_file,folder)
File "/home/work/baidu/chengxin-qa/monitor/pilu/case/xzhHome/arrow/xzharrow.py", line 94, in main
browser = wd.Firefox()
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 162, in __init__
keep_alive=True)
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/home/work/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status signal