Python selenium Access Denied when clicking buttons

Viewed 208

I've been using selenium for a while now and today I've come across an issue I was hoping someone could help me out with.

I use this code to access the page I want to go to...

user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36'
options = selenium.webdriver.ChromeOptions()
options.add_argument('user-agent={0}'.format(user_agent))
...
driver = webdriver.Chrome(driverpath,chrome_options=options)
driver.get(url)

This works fine, however, when I attempt to click on a button that will take me to another page or load some content, I get taken to an Access Denied page.

button = driver.find_element_by_class_name('abutton')
button.click()

I was wondering if this could possibly be because the browser "forgets" my user-agent? This is my current theory as I get the exact same Access Denied page when I do not include my user-agent.

0 Answers
Related