Is there any way to use browser preference like "network.negotiate-auth.trusted-uris"
in phantomJS.
Below is the syntax for selenium with 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 any similar feature available in PhantomJS.
You can pass desired_capabilities
keyword argument when you create PhantomJS
object.
For example, to 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 for other available settings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.