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

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -