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
• 17,100 points
1,456 views

1 answer to this question.

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,460 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,360 points
6,874 views
+1 vote
2 answers

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

FindElement Command -This method locates for the ...READ MORE

answered Feb 11, 2020 in Selenium by anonymous
8,020 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 May 15, 2019 in Selenium by Abha
• 28,140 points
1,529 views
0 votes
1 answer

What is the use of getOptions() method in Selenium?

Hi Urmila, getOptions() is used to get all ...READ MORE

answered May 31, 2019 in Selenium by Abha
• 28,140 points
9,648 views
0 votes
2 answers

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,500 points
12,617 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,572 views
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,910 points
6,629 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,519 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,460 points
3,513 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,460 points
6,847 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP