简体   繁体   English

Selenium Chrome 驱动程序无法定位元素 INPUT

[英]Selenium Chrome Driver Unable to locate element INPUT

ERROR: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='label-input']//input"}错误:没有这样的元素:无法找到元素:{"method":"xpath","selector":"//div[@class='label-input']//input"}

I need to send a Username to here https://prnt.sc/sf9t14 https://prnt.sc/sfaqre我需要发送一个用户名到这里https://prnt.sc/sf9t14 https://prnt.sc/sfaqre

HELP ME PLEASE BROS:)请帮帮我:)

Fist you have to switch the frame:拳头你必须切换框架:

driver.SwitchTo().Frame(driver.FindElement(By.Xpath("//iframe[@class='gameframe']")));

Then you can type the input然后你可以输入输入

IWebElement userInput = driver.FindElement(By.Xpath("//div[@class='label-input']/input"));
userInput.SendKeys("username");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM