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,020 points
97 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,420 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,270 points
1,210 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
• 13,960 points
562 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 in Selenium by Abha
• 27,180 points
40 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 in Selenium by Abha
• 27,180 points
1,054 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,110 points
944 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
1,121 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
860 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,420 points
163 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,420 points
1,456 views