0

I am trying to click on one element and also trying for sendkeys.

I am able to see id and name of the element, but when I am trying to click on it, it is giving me:

Unable to locate element: #customer_firstname

Check below HTML

<input onkeyup="$('#firstname').val(this.value);" class="is_required validate form-control" data-validate="isName" id="customer_firstname" name="customer_firstname" value="" type="text">

I have simply tried by id, name and xpath.

driver.findElement(By.id("customer_firstname")).sendKeys("ddddd");
driver.findElement(By.name("customer_firstname")).sendKeys("ddddd");
driver.findElement(By.xpath(".//*[@id='customer_firstname']")).sendKeys("ddddd");

Here is the code

driver.get("automationpractice.com/index.php"); driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email_create")).sendKeys("test@te‌​st.com"); driver.findElement(By.id("SubmitCreate")).click(); //driver.findElement(By.name("firstname")).sendKeys("dsdsd"‌​); driver.findElement(By.name("customer_firstname")).sendKeys(‌​"sadsa"); 
  • Is your control actually visible on the page when it fails? You may need to use an explicit wait for the control. Is your control embedded in an iframe? If so, you would need to switch to that frame first. – Breaks Software Oct 25 '17 at 17:18
  • @BreaksSoftware I tried explicit wait. Also tried till element is visible but it return 0 – Shivaji Ghadge Oct 25 '17 at 17:28
  • @SakshiRaina this is different issue. even if I try to enter in driver.findElement(By.name("firstname")).sendKeys("dsdsd"); which having html it giving meelement not found – Shivaji Ghadge Oct 25 '17 at 17:34
  • would it be possible to share a link to the page in question? – Breaks Software Oct 25 '17 at 17:41
  • @BreaksSoftware driver.get("http://automationpractice.com/index.php"); driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email_create")).sendKeys("test@test.com"); driver.findElement(By.id("SubmitCreate")).click(); //driver.findElement(By.name("firstname")).sendKeys("dsdsd"); driver.findElement(By.name("customer_firstname")).sendKeys("sadsa"); – Shivaji Ghadge Oct 25 '17 at 17:44
  • got solution thanks all – Shivaji Ghadge Oct 25 '17 at 18:24

0 Answers0