1
votes

Unable to locate the 'Number of instances' field on https://cloud.google.com/products/calculator/ by the customized XPath with WebDriver (Java-powered)

I have tried the xpath: //input[@name = "quantity" and @id="input_52"] It works fine with Ctrl + F with the Chrome inspect code feature, but not with WebDriver

Here is the stacktrace message in Idea: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@name = "quantity" and @id="input_52"]"}

Thank You for Your kind help in advance

1

1 Answers

0
votes

element you trying to operate on is inside frame you have to select frame then you can perform operation on element do the following step to reach to element inside iframe(id of iframe is - id="idIframe") -

driver.switch_to.frame('idIframe');
driver.find_element_by_xpath("//input[@name = 'quantity' and @id='input_52']");