我可以填写用户名/电子邮件和密码,但我不能点击个人安全复选框。
我已在此处选中有问题的复选框:
网址:https://www.trendyol.com/uyelik
以下是我迄今为止尝试过的方法:
from xml.etree.ElementPath import xpath_tokenizer
from selenium import webdriver
import requests
from selenium.webdriver.common.keys import Keys
import time
import random
def start():
driver = webdriver.Chrome()
driver.implicitly_wait(3)
driver.get ('https://www.trendyol.com/uyelik')
input('Harf gir.')
mail = driver.find_element("xpath",'//*[@id="register-email"]')
mail.send_keys("emrah.gumruk@gmail.com")
time.sleep(0.5)
password = driver.find_element("xpath",'//*[@id="register-password-input"]')
time.sleep(0.5)
password.send_keys("Emrah6161")
male = driver.find_element ("xpath",'//*[@id="login-register"]/div[3]/div[1]/form/div[3]/div/button[2]')
male.click()
time.sleep(0.5)
c1=driver.find_element ("xpath",'//*[@id="login-register"]/div[3]/div[1]/form/div[5]/div/div[1]/div/svg')
c2=driver.find_element ("xpath",'//*[@id="login-register"]/div[3]/div[1]/form/div[6]/div/div[1]/div/svg')
time.sleep(0.5)
c1.click()
c2.click()
time.sleep(0.5)
onay=driver.find_element ("xpath",'//*[@id="login-register"]/div[3]/div[1]/form/button')
onay.click()
time.sleep(20)
start()
我尝试复制div的xpath并使用单击功能,但它不工作。
1条答案
按热度按时间sg2wtvxw1#
要单击与 * marketing-email * 相关的***clickable***元素,您需要为element_to_be_clickable()引入WebDriverWait,您可以使用以下locator strategies之一: