How to get the XPath of an element?

0 votes
I am trying to search for a keyword and want to locate the search box of google using XPath, How can I do that?

Can someone help please?
Dec 19, 2018 in Selenium by Jino
• 5,520 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

To get the xpath of an element all you need to do is 

1. inspect the webpage

2. select the element you want the xpath for.

3. right click on the code higlighted

4. Go to copy 

5. Go to copy Xpath


Here is a screeshot I took to explain the above steps.

Hope this helps.

answered Dec 19, 2018 by Nabarupa

Related Questions In Selenium

0 votes
1 answer

How to find the absolute xpath of an element?

You can use the tool called chroPath ...READ MORE

answered Jan 7 in Selenium by Anjali
• 2,910 points
0 votes
1 answer

How to get the text from all the cells of an HTML table?

This worked for me. Check this out import ...READ MORE

answered May 10 in Selenium by Surya
• 820 points
0 votes
1 answer

How to get next sibling element using XPath and Selenium for Java?

Below code will help you: Try following-sibling axis : WebElement ...READ MORE

answered May 15, 2018 in Selenium by Samarpit
• 5,130 points
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
+1 vote
2 answers

How to get the title of a webpage using Selenium Java?

Essentially, driver.getTitle(); function can be used to ...READ MORE

answered Dec 17, 2018 in Selenium by Vardhan
• 10,620 points
0 votes
1 answer

How to resolve the issue: Xpath for node without text but child has text

This will help you: //strong[not(normalize-space(text()))]/span[tex ...READ MORE

answered Jun 11, 2018 in Selenium by Samarpit
• 5,130 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.