9jgaeq
Last Updated: January 06, 2017
·
23.73K
· pykler
88dcd9a1b56c02e905ac3a352e43ba81

Set phantomjs user-agent string

Set the user agent for phantomjs driver

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"] = (
    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53 "
    "(KHTML, like Gecko) Chrome/15.0.87"
)
driver = webdriver.PhantomJS(desired_capabilities=dcap)

4 Responses
Add your response

16875
Me

It's just that I need.
Thank you very much !!!

over 1 year ago ·
17773
Black parker

awesome! thanks

over 1 year ago ·
18714
None

Muchos gracias!

over 1 year ago ·
24951
None

Great! You helped me a lot!

over 1 year ago ·