I'm trying to locate a form, but the application doesn't have form names.

I tried:


I want to locate and the form and input text into it.

The error is:

Unable to locate element: {"method":"xpath","selector":"//input[@type='__BVID__42_']"}
  • 2
    What is your html?
    – Patrick
    Jan 17, 2018 at 12:45
  • try to wait till the webelement is completely loaded and then try to click it. You can use Thread.sleep() which is not advisable or you can try WebDriverWait class.
    – Alok
    Jan 17, 2018 at 15:31

4 Answers 4


Use your browsers development tools to find the xpath of the element you are trying to click.

Note: xpaths (as identified by your browser) are prone to change when the UI changes, leading to flaky tests.

TIP: If your team is also responsible for developing the Front end, get them to add unique identifiers to the elements you need to interact with, so you can use those in your xpath/Locators; this will make your tests way more stable and reliable!


Wait for the Element is to be able to clickable by the below code,

WebDriverWait wait = new WebDriverWait(YOUR DRIVER, WAIT SOME SECONDS);



At starting of your code have you used implicit wait? if not use that. I think the error is coming because the page is not loaded fully but script starts looking for the element. You can use implicit wait in two parts: First, before the script starts you can tell to wait 60 seconds as the page is downloaded fully or you can use with an element.

Before starting locating for an element you can use the following code

System.setProperty("webdriver.chrome.driver", "D:\\chrome driver selenium\\chromedriver.exe");
driver= new ChromeDriver();
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(120, TimeUnit.SECONDS);

Do you happen to have frame in your DOM? if you do and if you are using ruby and pageobject, refer to this code snippet:

class RegistrationPage
  include PageObject

  in_frame(:id => 'left-frame') do |frame|
    text_field(:address, :id => 'address_id', :frame => frame)

This basically says to look for frame by id and locate text_field in that frame.

for more reference check here on Github.


Not the answer you're looking for? Browse other questions tagged or ask your own question.