Getting no such element: Unable to locate element error when writing with XPath or CSS. Please help
diver.findElement(By.cssSelector("ticket-title-input")).sendKeys("hello");
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityTry using any of the following Xpaths,
//input[@id='ticket-title-input']
//div[@id='ticket-title-panel']//following-sibling::input
//div/following::input[@id='ticket-title-input']
Try
diver.findElement(By.cssSelector("#ticket-title-input")).sendKeys("hello");
#
means you take element with id. Check this post for details.
As guessed, the element is present inside a frame.
Please switch to the frame with below xpath.
//iframe[@src = 'vcr/1404/Pages/newTicketV2.html']
Pass the instance of web element of the iframe above as argument to the
driver.switchTo().frame(_element);
Then perform the interaction with the intended element
//input[@id = 'ticket-title-input']
After the interaction is over and when you think you dont have interact with any other element inside that frame, switch to default content
I believe that the element is present inside a frame, had a look at the top-most html line.
I would suggest,
Hope this helps. Please share the entire html for better response.