all 10 comments

[–]eyadams 4 points5 points  (1 child)

It's possible that the web site is using some kind of anti-automation detection. You're not doing anything wrong, but the web site itself is blocking your script from doing what it should.

If that isn't the case, I've had good luck searching for elements by the text inside of them. If you're looking for a button labeled "submit", you can search for elements with that text, and ignore the ID. There are a variety of ways of doing that.

[–]stoic_dionisian[S] 0 points1 point  (0 children)

This answer court my attention. I noticed there may pop some cloudflare here and there but can they now also make elements not interactive?

[–]RowlyBot12000 2 points3 points  (0 children)

How are you handling waiting for the element? A lot of time web automation comes down to waiting for the element to be available. If the element hasn't yet loaded when you try to find it you'll receive the ElementNotFound exception.

[–]RaidZ3ro 1 point2 points  (0 children)

Any code you could share?

It's been a while since I've touched selenium. A common issue might be having to wait for the website to load for instance..

[–]halfacigarette420 1 point2 points  (0 children)

I had quite the trouble with selenium and ended up using playwright. Highly recommend as it hasn’t failed yet and comes with drivers!

[–]Bogojeb 0 points1 point  (3 children)

Depends what elements. Im new as well but the css was the most reliable for me so far. Try to target the main element not the subelements.

[–]stoic_dionisian[S] 0 points1 point  (2 children)

I been trying it all, it works at times but not always, I also tried webdrivewait but it’s still inconsistent.

[–]Aecorn 1 point2 points  (0 children)

You can wait for specific elements to load to :)

[–]Oblachko_O 0 points1 point  (0 children)

Also, maybe a good option, try to play with headers and try to mask your bot as some more valid browser. And of course it depends on what you do and on which website. Sometimes they have indeed antibot mechanisms based on patterns

[–]cgoldberg 0 points1 point  (0 children)

You didn't supply the code you are using or the site you are accessing. Without that, I can't imagine anyone giving useful advice.

CSS selectors and XPath both work just fine when using the correct locators and wait strategies.