Home > OS >  python click accept on a website in selenium
python click accept on a website in selenium

Time:04-02

I try to click this button in selenium python

website : nbsklep.pl

enter image description here

i try like this :

  element = self.driver.find_element_by_xpath("/html/body/reach-portal[2]/div[2]/div[2]/div/div[2]/button[2]")
  element.click()

Everythingthing is correct.. Path is good i don't know why it dont clicks it. Using the newest chromedriver v100~.

CodePudding user response:

from selenium import webdriver
import time

driver = webdriver.Chrome("chromedriver")
driver.get("https://nbsklep.pl/")
time.sleep(2)
driver.find_element_by_css_selector("body > reach-portal:nth-child(7) > div.CookieInfo_modal__8bL4N > div.CookieInfo_content__h3sZ5 > div > div.CookieInfo_settingsActions__i_8lc > button:nth-child(3) > span").click()
time.sleep(2)

CodePudding user response:

You can use the following CSS selector to interact with the desired web element.

button[class='Button_button__Nw3FH Button_buttonSizeLarge__68E7y']
  • Related