unable to find element..

30 views
Skip to first unread message

javel...@gmail.com

unread,
Apr 21, 2018, 9:15:28 AM4/21/18
to Selenium Users
Hello Selenium users... 

I have started on selenium and facing a problem... error is as following.. 

Error:::: Unable to locate element: #\/\/input\[\@id\=\'datepicker1\'\]


The line code is as following:: 
driver.findElement(By.id("//input[@id='datepicker1']")).click();

Everything seems ok to me... Can anyone please find the error in above line... 

Thanks, 
Java learner

abhijit apte

unread,
Apr 22, 2018, 12:32:59 AM4/22/18
to seleniu...@googlegroups.com
Try this. When you are using id as location strategy, no need to provide xpath. 


driver.findElement(By.id("datepicker1")).click();


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/30e58a38-948a-42b9-ae47-dc4cf3d91710%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Thanks,
Abhijit Apte

Java Learner

unread,
Apr 22, 2018, 12:36:14 AM4/22/18
to seleniu...@googlegroups.com
Thanks! I really missed that. 



You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/UA1a114eN48/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Javed Sayyed

unread,
Apr 22, 2018, 7:46:09 AM4/22/18
to seleniu...@googlegroups.com
The syntax of clicking an element using ID should be as mentioned below.

driver.findElement(By.id("datepicke")).click();

Regards
Javed

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages