python - How to set browser preference in PhantomJS using Selenium -


is there way use browser preference "network.negotiate-auth.trusted-uris" in phantomjs.

below syntax selenium firefox:

p_profile = webdriver.firefoxprofile() p_profile.set_preference("network.negotiate-auth.trusted-uris", "https://xx.com") driver = webdriver.firefox(p_profile) driver.get("https://xx.com") 

is there similar feature available in phantomjs.

you can pass desired_capabilities keyword argument when create phantomjs object.

for example, change user-agent header:

from selenium import webdriver   cap = webdriver.desiredcapabilities.phantomjs.copy()                             cap['phantomjs.page.settings.useragent'] = 'asdf' driver = webdriver.phantomjs(desired_capabilities=cap) driver.get('http://httpbin.org/headers') print(driver.page_source) driver.quit() 

check settings - phantomjs other available settings.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -