27

I am trying to get the actual user agent that I am using in Selenium, at the moment with the chromedriver.

I found a Java version of this problem: How to get userAgent information in Selenium Web driver.

Does someone know how to do that in Python?

1

1 Answer 1

57

The same manner as inside your link:

user_agent = driver.execute_script("return navigator.userAgent;")

PS: Using execute_script method you can run JS inside your driver.

Hope it helps you!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.