I have this webpage (https://goldapple.ru/) on which I want to parse some data about cosmetics. However, when I open the webpage, the popup button appears, and I want to click the left "Да, верно". Unfortunately, the TimeoutException(message, screen, stacktrace) error appears, so the problem is that the machine doesn't see the button.
The webpage HTML code:
<button type="button" class="MMwlC KQN8E yVRvi I1E8J PrKjg Rt0VH"><span class="_1MvHE"><span class="nOERC">
Да, верно
</span> <span class="SdR9G" style="display: none;"><div class="o8w4X"><div class="-tctp"></div> <div class="-tctp"></div> <div class="-tctp"></div> <!----></div></span></span></button>
My code's like that:
#import some dependencies
from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from time import sleep
#actual code
browser = Chrome()
url = "https://goldapple.ru/"
browser.get(url)
wait = WebDriverWait(browser, 10)
wait.until(
EC.element_to_be_clickable((By.XPATH, "//*[@id='__layout']/div/div[5]/div[2]/div[1]/div/div[2]/button[1]"))
).click()
Some facts you need to know imho:
- I used the WebDriverWait to get some time for a popup button to appear
- I used the element_to_be_clickable condition
- XPATH was used as a reference to the button, so there should be no problem with the address
- There's no shadow root on a webpage
P.S. Some motivation: If someone solves the problem, it would be considered (at least by me) as the Selenium breakthrough