G
G
GotLib12021-07-18 15:16:28
Python
GotLib1, 2021-07-18 15:16:28

What should I do if an extra argument with # is added to the url when writing driver.get?

selenium. The essence of the problem is that when I go to the page via driver.get(url), which I specify in the url, some #old argument is sometimes added to the url itself, that is, the url looks something like this: example.com/lala/ #old and html also change.
Question: Have you met someone like that? And how can driver.get create a condition so that it loads only the page that I specified in the url without extra arguments?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EgorSvinarev, 2021-07-19
@GotLib1

If this behavior is not typical for requests from a client browser, then try changing the user-agent for the driver

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("user-agent=[user-agent string]")

driver = webdriver.Chrome(executable_path='path', chrome_options=options)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question