大佬教程收集整理的这篇文章主要介绍了无法使用ruby selenium webdriver连接到浏览器,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
driver = SELEnium :: WebDriver.for:firefox,:profile => ‘默认’
我得到的错误是:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/SELEnium-webdriver-2.24.0/lib/SELEnium/webdriver/remote/http/common.rb:66:in `create_response': unexpected response,code= 403,content-type="text/html" (SELEnium::WebDriver::Error::WebDriverError) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META http-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <titlE>ERROR: The requested URL could not be retrieved</titlE> <STYLE type="text/css"><!--BODY{BACkground-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE> </HEAD><BODY> <H1>ERROR</H1> <H2>The requested URL could not be retrieved</H2> <HR noshade size="1px"> <P> While trying to retrieve the URL: <A HREF="http://127.0.0.1:7055/hub/session">http://127.0.0.1:7055/hub/session</A> <P> The following error was encountered: <UL> <LI> <STRONG> Access Denied. </STRONG> <P> Access control configuration prevents your request from being allowed at this time. please contact your service provider if you feel this is incorrect. </UL>
浏览器打开正确的配置文件,但导致的驱动程序变量为零.我甚至试图在配置文件上手动设置代理,没有运气.
有任何想法吗 ?
ENV['http_PROXY'] = ENV['http_proxy'] = nil driver = SELEnium::WebDriver.for :firefox
如果您需要为Firefox配置的代理与外界通信,可以尝试以下方式:
proxy = SELEnium::WebDriver::Proxy.new(:http => ENV['http_PROXY'] || ENV['http_proxy']) ENV['http_PROXY'] = ENV['http_proxy'] = nil driver = SELEnium::WebDriver.for :firefox,:proxy => proxy
以上是大佬教程为你收集整理的无法使用ruby selenium webdriver连接到浏览器全部内容,希望文章能够帮你解决无法使用ruby selenium webdriver连接到浏览器所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。