带的小弟遇到这个问题不知所措就找我解决,记录一下。
执行如下代码,chrome和IE都OK,执行火狐就挂了。
#浏览器数组
lists = ['chrome','internet explorer','firefox']
#循环浏览器执行脚本
for browser in lists:
print browser
driver = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities={'platform':'ANY',
'browserName':browser,
'version':'',
'javascriptEnabled':True
})
driver.implicitly_wait(30)
driver.get('http://www.baidu.com')
driver.find_element_by_id("kw").clear()
driver.find_element_by_id("kw").send_keys("unittest")
driver.find_element_by_id("su").click()
time.sleep(1)
title = driver.title
print title
Traceback (most recent call last):
File "D:\workspace-tradeadmin\pydevTest\src\date06\seleniumGrid\test2.py", line 19, in <module>
'javascriptEnabled':True
File "F:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 74, in __init__
self.start_session(desired_capabilities, browser_profile)
File "F:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 123, in start_session
'desiredCapabilities': desired_capabilities,
File "F:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "F:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
nymous2012254099297209597webdriver-profile\\extensions\\[email protected]","e":true,"v":"1.2.5","st":1435203687047},"[email protected]":{"d":"C:\\Users\\dyyt\\AppData\\Local\\Temp\\anonymous2012254099297209597webdriver-profile\\extensions\\[email protected]","e":false,"v":"2.42.2","st":1435203685165,"mt":1435203685138},"[email protected]":{"d":"C:\\Users\\dyyt\\AppData\\Local\\Temp\\anonymous2012254099297209597webdriver-profile\\extensions\\[email protected]","e":true,"v":"3.0.37","st":1435203687053},"[email protected]":{"d":"C:\\Users\\dyyt\\AppData\\Local\\Temp\\anonymous2012254099297209597webdriver-profile\\extensions\\[email protected]","e":true,"v":"1.1.3","st":1435203687059}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","e":true,"v":"37.0.2","st":1435200785629,"mt":1429136985000}}}
1435203692905 addons.xpi DEBUG No changes found
1435203692908 addons.xpi DEBUG Registering manifest for C:\Users\dyyt\AppData\Local\Temp\anonymous2012254099297209597webdriver-profile\extensions\[email protected]
1435203692908 addons.xpi DEBUG Loading bootstrap scope from C:\Users\dyyt\AppData\Local\Temp\anonymous2012254099297209597webdriver-profile\extensions\[email protected]
1435203692911 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 0.10
1435203692937 addons.xpi DEBUG Registering manifest for C:\Users\dyyt\AppData\Local\Temp\anonymous2012254099297209597webdriver-profile\extensions\[email protected]
1435203692938 addons.xpi DEBUG Loading bootstrap scope from C:\Users\dyyt\AppData\Local\Temp\anonymous2012254099297209597webdriver-profile\extensions\[email protected]
1435203692940 addons.xpi DEBUG Calling bootstrap method startup on [email protected] version 1.1.3
1435203692958 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1435203692958 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1435203692959 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1435203692959 addons.manager DEBUG Registering shutdown blocker for PluginProvider