How to get the enter username using ID locator in Facebook

0 votes
I am trying to automate the login process of facebook. Such that it directly takes the user id and password and logs in the account. I am new to selenium so can someone help me doing this? Thank you in advance.
Dec 18, 2018 in Selenium by Anjali
• 2,950 points
2,760 views

1 answer to this question.

0 votes

To use the ID locator to test the username textbox, you should inspect the webpage and see the ID for the particular element.

Like this:

Now that you know what is the ID for the username's text box, use the following lines of code to test/ provide an input to the text box

driver.get("https://www.facebook.com");
driver.findElement(By.id("email")).sendKeys("username@gmail.com");

This way you can provide an input in the username's textbox.

Hope this helps.

answered Dec 18, 2018 by Nabarupa

Related Questions In Selenium

+4 votes
1 answer
+1 vote
1 answer
+1 vote
1 answer

How to get the HTML source of a webpage using Selenium in Java?

There is a method called getPageSource() in ...READ MORE

answered Jan 11, 2019 in Selenium by Sneha
29,496 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
13,687 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
9,150 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
7,230 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,881 views
+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
• 13,150 points
15,926 views
+10 votes
17 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,360 points
198,022 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