x-Palace
x-Palace

Reputation: 43

Python Selenium How can I click this button

I'm trying to click a button on a site. I tried many methods but I cannot click.

How can i click the user button?

Also I'm not getting any error.My code snippet completes and ends without clicking that button

Site: https://www.mackolik.com/

sour code

First:

uye = browser.find_element_by_xpath('/html/body/header/div[2]/div[3]/div')
ActionChains(browser).move_to_element(uye).perform()

Second:

 ileri2 = browser.find_element_by_xpath('//*[@id="passwordNext"]/div/button/span')
 browser.execute_script("arguments[0].click();", ileri2)

Upvotes: 1

Views: 69

Answers (1)

Alexandra Dudkina
Alexandra Dudkina

Reputation: 4462

This worked for me:

import selenium
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains

btn = WebDriverWait(driver, delay).until(EC.element_to_be_clickable((By.CLASS_NAME, 'widget-login__icon')))
driver.execute_script("arguments[0].scrollIntoView();", btn);
ActionChains(driver).move_by_offset(btn.location.get('x') + btn.size.get('width') / 2, btn.location.get('y') - btn.size.get('height') * 1.5).click().perform()

Upvotes: 1

Related Questions