Can't click button in selenium, but can click it in regular chrome tab

45 Views Asked by At

I am trying to build a software solution that adds emails to my job board's newsletter by automatically typing in an email and clicking "create alert". When using regular google chrome, I am able to click the "create alert", but when using selenium's browser it doesn't let me click the button even without automation. i'm wondering if i would have to automate the process using pure javascript. Let me share the page i am having trouble with: https://goflexboard.com/jobs/?categories[]=Manufacturing

Here I am trying to create a job alert which is a newsletter that sends recommended jobs every day. It is letting me click create alert from regular google chrome, but not from the chrome browser controlled by selenium.

I tried clicking it in regular chrome and it worked, but when i try in selenium it does not work.

1

There are 1 best solutions below

5
Shray On

What error are you getting?

I suppose the error is element not found?

Just add a condition to wait for the element to appear before you click it.

Sometimes the response time of browsers vary.

# Adjust the time as necessary

element = WebDriverWait(driver, 10).until( EC.visibility_of_element_located(locator) )

https://www.selenium.dev/documentation/webdriver/waits/ here are different waits. the one above is an explicit wait. you can refer to this doc and use implicit wait , as it is less flaky. explicit wait will help you diagnose if the problem is with load time.

https://www.linkedin.com/pulse/how-measure-page-load-times-selenium-sarah-elson/ here is how you can see if page load time vary for you. just if you are curious and want to learn about load times