0
votes

ERROR: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='label-input']//input"}

I need to send a Username to here https://prnt.sc/sf9t14 https://prnt.sc/sfaqre

HELP ME PLEASE BROS :)

1
It would be easier to use the CSS selector method with selector like 'div.choose-nickname-view div.label-input input' or assign an id attribute to the input field and select it with id method. - Dmytro
If it was me, I'd make sure the input element had an id, then you can use By.Id rather than the mystery that is xpath. - Neil
Another print with CSS prnt.sc/sfaqre if you can help... - Samuel Dias

1 Answers

0
votes

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");