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,930 points
150 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
0 votes
1 answer
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
943 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
859 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
• 12,730 points
555 views
+9 votes
15 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,270 points
70,225 views