我无法使用Selenium点击按钮。

huangapple go评论67阅读模式
英文:

I can't push button with Selenium

问题

website: (https://www.tiktok.com/signup/phone-or-email/email)
我想点击"发送验证码"按钮,但没有任何反应。
driver2.find_element(By.XPATH, '//button[@class="tiktok-1fcfbw8-ButtonSendCode e1gzcpl10"]')

我已尝试使用XPATH和CLASS_NAME查找,尝试使用ActionChains进行点击。
但没有起作用。

英文:

website: (https://www.tiktok.com/signup/phone-or-email/email)
I want to push button "Send code", but nothing happen.
driver2.find_element(By.XPATH, '//button[@class="tiktok-[enter image description here]
(https://i.stack.imgur.com/i7LGv.png)1fcfbw8-ButtonSendCode e1gzcpl10"]')

I had tried find by XPATH, CLASS_NAME; tried do click by ActionChains.
But it's not work

答案1

得分: 0

以下是翻译好的部分:

"按钮的类是动态的,并且每次运行都会更改,这就是为什么它不起作用,所以你必须使用

#//button[text()="Send code"]
driver2.find_element(By.XPATH, '//button[text()="Send code"]')

此外,只有在填写所有字段之后才会启用它,所以在点击之前你应该这样做"

英文:

The class for button is dynamic and changes for every run that why its not working ,so you have to use

#//button[text()="Send code"]
driver2.find_element(By.XPATH, '//button[text()="Send code"]')

Also it will only enable after all fields are filled so you should do that before clicking on it

huangapple
  • 本文由 发表于 2023年5月14日 17:39:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76246787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定