0

I'm writing a bot to automate a browser game with Selenium. When an error happens, the bot automatically pauses the driver. Even when the button element is clearly visible in the browser, selenium times out after not finding the element.

gold_btn = wait.until(EC.element_to_be_clickable((By.XPATH, '//[@id="perk_target_4"]/div[2]/div[1]/div')))

HTML of the element:

<div class="button_blue pointer" style="height: 11px; width: 120px; padding-top: 2px;">Protein hapları</div>

Even though the operation done is always the same, the loop works for some time, seeing this element. But after like an hour of runtime, it times out after not seeing this element.

I tried adding waits before the button appears, which did not change the outcome.

I was expecting it to just continue as it normally does. It should be able to see the element especially since it is pretty much visible in the browser window and the wait is 30 seconds.

1 Answers1

0

HTML <div> Tag

The <div> tag defines a division or a section in an HTML document. The <div> tag is used as a container for HTML elements which is further styled with CSS and/or manipulated with JavaScript. The <div> tag is also styled using the class or id attribute.

Generally, <div> tags aren't clickable unless they contain some special attributes. So possibly your target element is some other element but not a <div> tag.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • It is clickable though, the buttons are all div's in the website, it clicks for like 3 loops, but on the 4th loop it times out after not detecting the element. I tried visibility and presence too, still times out after some runtime – selcukwashere Jul 08 '23 at 20:10
  • Any help? Still haven't found a solution, especially as my problem is not with clicking but with detecting the element, which should be detectable since it is visible. – selcukwashere Jul 16 '23 at 15:08
  • @selcukwashere Update the question with the text based HTML of the element. – undetected Selenium Jul 16 '23 at 18:29
  • Updated the question, I can add the parent divs too if you want – selcukwashere Jul 17 '23 at 07:20