findElement Method in Selenium

0 votes

I want to understand the different interfaces and classes implemented in Selenium methods

I came to know that Interface SearchContext is inherited by interface WebDriver and which in turn is implemented by different classes like ForefoxDriver and so on....

findElement is a method as part of SearchContext interface and which is implemented by the Firefox driver. There is another class called "By" which has of nested subclasses.

Syntax for findElement is:

driver.findElement(By.name("abc"));

Can anyone tell me what exactly is the parameter which is passed to this findElement function?

Apr 24, 2018 in Selenium by Perry
• 16,450 points
42 views

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

This is a way in which Selenium selects elements, this is similar to fluent API. 

It makes easy for the users to read. The parameter you pass into findElement is kind of like a pseudo-selector query, like Jsoup.

For example, if you wanted to select the logo at the top right hand corner of this page, you could do

driver.findElement(By.id("hlogo"));

So the query By.name("q") basically selects element(s) with the attribute, name="abc"

answered Apr 24, 2018 by Meci Matt
• 9,400 points

Related Questions In Selenium

0 votes
1 answer

selenium.waitForPageToLoad(“30000”) method in Selenium WebDriver

You can use two approaches using Selenium ...READ MORE

answered Apr 9, 2018 in Selenium by Vardy
• 2,280 points
524 views
0 votes
1 answer

What is the difference between findElement and findElements in Selenium Webdriver?

Hi Nilaabh, Selenium Webdriver uses findElement and ...READ MORE

answered May 8 in Selenium by Anvi
• 5,680 points
24 views
0 votes
1 answer

i am not able to perform this method in selenium driver.get("google")

Hi Sachin, are you getting any errors ...READ MORE

answered 5 days ago in Selenium by Abha
• 5,480 points
15 views
0 votes
3 answers

How to specify "ENTER" button functionality in Selenium WebDriver code?

using OpenQA.Selenium.Interactions; Actions builder = new Actions(driver); ...READ MORE

answered Feb 12 in Selenium by anonymous
4,302 views
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
56 views
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
420 views
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
43 views
0 votes
1 answer

How can I Install Selenium IDE in Firefox

Selenium IDE works with all Firefox versions, ...READ MORE

answered Apr 13, 2018 in Selenium by Meci Matt
• 9,400 points
44 views
0 votes
1 answer

XPath for the elements with no ID or Name in Selenium Webdriver

Use like this or similar to this: //div[@id="top-level-menu-item-3"]/div[@class="filter-label"] //div[@id="top-level-menu1"] ...READ MORE

answered Apr 17, 2018 in Selenium by Meci Matt
• 9,400 points
742 views

© 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.