Setting custom User Agent in Selenium Webdriver for PhantomJS with Ruby -



Setting custom User Agent in Selenium Webdriver for PhantomJS with Ruby -

i've been on net tonight, 3-4 hours now. i've tried every suggestion i've come across. i've checked "capabilities" object on selenium driver object ensure set there, , indeed, is:

#<selenium::webdriver::remote::capabilities:0x00000007475cf0 @capabilities= {:browser_name=>"phantomjs", :version=>"1.9.7", :platform=>:"linux-unknown-64bit", :javascript_enabled=>true, :css_selectors_enabled=>true, :takes_screenshot=>true, :native_events=>true, :rotatable=>false, :firefox_profile=>nil, :proxy=>#<selenium::webdriver::proxy:0x00000007475908 @type=:direct>, "drivername"=>"ghostdriver", "driverversion"=>"1.1.0", "handlesalerts"=>false, "databaseenabled"=>false, "locationcontextenabled"=>false, "applicationcacheenabled"=>false, "browserconnectionenabled"=>false, "webstorageenabled"=>false, "acceptsslcerts"=>false, "proxy"=>{"proxytype"=>"direct"}, "phantomjs.page.settings.useragent"=> "mozilla/5.0 (x11; ubuntu; linux i686; rv:27.0) gecko/20100101 firefox/27.0"}>

besides "phantomjs.page.settings.useragent", i've tried "useragent", etc. every thing find online in lastly 3-4 hours, i've tried. apparently, near origin of 2013, quite mutual question, , solutions i'm speaking of apparently mutual solutions. none of these working, , in fact, know sure bit of info (note user-agent "ruby"):

uncaught exception: {"errormessage"=>"element not visible , may not manipulated", "request"=> {"headers"=> {"accept"=>"application/json", "accept-encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "connection"=>"close", "content-length"=>"2", "content-type"=>"application/x-www-form-urlencoded", "host"=>"localhost:9876", "user-agent"=>"ruby"}, "httpversion"=>"1.1", "method"=>"post", "post"=>"{}", "postraw"=>"{}", "url"=>"/click", "urlparsed"=> {"anchor"=>"", "query"=>"", "file"=>"click", "directory"=>"/", "path"=>"/click", "relative"=>"/click", "port"=>"", "host"=>"", "password"=>"", "user"=>"", "userinfo"=>"", "authority"=>"", "protocol"=>"", "source"=>"/click", "querykey"=>{}, "chunks"=>["click"]}, "urloriginal"=> "/session/a03cc440-4f5c-11e4-8854-ed9c22bf60af/element/%3awdc%3a1412822036214/click"}}

unfortunately, there lot more info , give-and-take on these kinds of selenium issues, , many others, if you're using java. @ point, wish in every way had gone java project, have 30,000 lines of code wrote exclusively myself on past 2 months. losing work, @ least, not devastating me personally, disastrous job.

what gives? going have dig in , customize source want, or feature really implemented now? again, saw answers 2013, don't work me, , have no thought why, or how prepare it. i'm on deadline origin stressful.

does have ideas me? maintain in mind i'm using ruby, not java.

selenium-webdriver 2.43. phantomjs 1.9.7. ghostdriver 1.1.0.

this seems incredulous, me, there no way modify user-agent.

please allow me know if can supply other info might of assistance.

i appreciate in advance if you'd kind share few ideas or info me pointed in right direction.

in java did following: (phantomjs 1.9.8, selenium 2.39)

string useragent = "mozilla/5.0 (linux; u; android 2.3.3; en-us; lg-lu3000 build/gri40) applewebkit/533.1 (khtml, gecko) version/4.0 mobile safari/533.1"; desiredcapabilities caps = new desiredcapabilities(); caps.setcapability(phantomjsdriverservice.phantomjs_page_settings_prefix + "useragent", useragent); phantomjsdriver driver = new phantomjsdriver(caps);

maybe there similar setting options ruby. take @ "page.settings.useragent"

ruby selenium-webdriver phantomjs user-agent ghostdriver

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -