I am testing a link using webdriver, but i am not able to locate where that link(element) is there on the webpage. How to detect that where the given element is present on the webpage? Can anybody help?
Asked
Active
Viewed 576 times
3 Answers
1
From the Getting Started Documentation, you can use:
WebElement element = driver.findElement(By.name("elementName"));
Where elementName
is the name of the element that you are looking for.
![](../../users/profiles/2123487.webp)
SeniorJD
- 6,240
- 4
- 32
- 50
![](../../users/profiles/2388906.webp)
Gnarlywhale
- 3,388
- 2
- 13
- 17
-
I am having trouble understanding how this answer constitutes a down-vote. – hmc_jake Jul 27 '15 at 22:48
0
Use Ctrl+Shift+I in chrome browser, and try to find that element in the developer's console using Ctrl+F. (You will have to click developer console's screen first before you do Ctrl+F)
![](../../users/profiles/5012866.webp)
zookastos
- 795
- 7
- 31
0
U can check the presence of element by using explicit wait
wait.until(ExpectedConditions.visibilityOf(element))
it will return true or false, boolean value can be used.
![](../../users/profiles/5725524.webp)
viki
- 11
- 7