PhantomJS + Selenium , How to se user agent for links that open in new window? -


i'm trying click on link opens in new tab (target="_blank") using selenium , phantomjs problem when phantomjs opens link, doesn't set user agent defined using desiredcapabilities. if link opens in current window ok opens in new window, user agent default 1 !

how can set user agent globally ? (btw i'm using python)

after doing investigation, found problem seem ghost driver. checked ghost driver github , found issue there 2013 , there temporary solution that. write solution here no result of github issue in google searches (https://github.com/detro/ghostdriver/issues/273) :

guaranteed solution links target = "_blank" , window.open - set phantomjs.page.customheaders.user-agent in desiredcapabilities. in case (window.open) may open new window "about:blank" url, find in handles array activate , surf.

so while not recommended set useragent in custom headers in selenium documents way set useragent globally doesn't change in new windows.


Comments

Popular posts from this blog

how to do line continuation in perl debugger for entering raw multi-line text (EOT)? -

javascript - Create websocket without connecting -

android - Linear layout children not scrolling -