WebDriverException:消息:“无法连接到ChromeDriver”utils.is_connectable(self.port)中的错误:
1.检查您是否安装了最新版本的chrome brwoser-> 2.如果没有,请安装最新版本的chrome installchrome 3.获取适当版本的chrome驱动程序通过以下链接http://chromedriver.storage.googleapis.com/index.html4.解压缩chromedriver.zip5.将文件移至/ usr / bin /目录 6.转到/ usr / bin /目录,则需要运行“ ”之类的文件以将其标记为可执行。7.最后,您可以执行代码。
import osfrom selenium import webdriverfrom pyvirtualdisplay import displaydisplay = display(visible=0, size=(800, 600))display.start()driver = webdriver.Chrome()driver.get('http://www.google.com')print driver.page_source.encode(’utf-8’)driver.quit()display.stop()解决方法
我正在尝试使用chromedriver 2.10在CentOS计算机上的Chrome浏览器35.0.1916.114版上运行测试
/home/varunm/EC_WTF_0.4.10/EC_WTF0.4.10_Project/wtframework/wtf/drivers/chromedriver
实际上,我修复了路径问题,因为如果问题出在路径上,则错误消息有所不同
def start(self): ''' Starts the ChromeDriver Service. :Exceptions: - WebDriverException : Raised either when it can’t start the service or when it can’t connect to the service ''' env = self.env or os.environ try:self.process = subprocess.Popen([ self.path,'--port=%d' % self.port] + self.service_args,env=env,stdout=PIPE,stderr=PIPE) except:raise WebDriverException( 'ChromeDriver executable needs to be available in the path. Please download from http://chromedriver.storage.googleapis.com/index.html and read up at http://code.google.com/p/selenium/wiki/ChromeDriver') count = 0 while not utils.is_connectable(self.port):count += 1time.sleep(1)if count == 30: raise WebDriverException('Can not connect to the ChromeDriver')
如果路径错误,我将收到其他错误,但是现在错误是在建立连接时
相关文章:
1. javascript - 一排三个框,各个框的间距是15px,距离外面的白框间距也是15px,这个css怎么写?2. javascript - Vue 的依赖追踪属于单向数据绑定还是双向绑定?3. html5 - javascript写业务有用到什么编程范式没?4. javascript - vue 数据更新了。但是dom没有更新,,,,,如图5. javascript - jQuery post()方法,里面的请求串可以转换为GBK编码么?可以的话怎样转换?6. javascript - vue 手机端项目在进入主页后 在进入子页面,直接按返回出现空白情况7. 网页爬虫 - python爬虫翻页问题,请问各位大神我这段代码怎样翻页,还有价格要登陆后才能看到,应该怎么解决8. html5 - vue-cli 装好了 新建项目的好了,找不到项目是怎么回事?9. mysql - C#连接数据库时一直这一句出问题int i = cmd.ExecuteNonQuery();10. javascript - 哪位大神指导下,如何实现今日头条头部导航列表,点那个类型,哪种类型就居中了?

网公网安备