Login page test script using selenium and java in Eclipse IDE

0 votes
I am new to Selenium and I want to write a script for login page using Selenium Java on Eclipse IDE. Help me with an example of logging in.
Apr 23, 2018 in Selenium by coldcode
• 2,050 points
5,498 views

1 answer to this question.

0 votes

Here is an example to login to Facebook:-

package FacebookDemos;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class FacebookLogin {

public static void main(String[] args) {

FacebookLogin obj = new FacebookLogin();

obj.loginBrowser();

}

public void loginBrowser() {

System.setProperty("webdriver.firefox.marionette","D:\\geckodriver.exe");

WebDriver driver = new FirefoxDriver();

driver.manage().window().maximize();

driver.manage().deleteAllCookies();

driver.manage().timeouts().pageLoadTimeout(15,TimeUnit.SECONDS);

driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

driver.get("http://www.facebook.com");

driver.findElement(By.name("email")).sendKeys("your email id");

driver.findElement(By.name("pass")).sendKeys("your password");

driver.findElement(By.id("loginbutton")).click();

}

}

answered Apr 23, 2018 by Meci Matt
• 9,460 points
issue in Chrome while using Seelenium Web driver
Hey @Sakshi, Could you please elaborate on what issue you are facing while using selenium webdriver in chrome?

Related Questions In Selenium

+1 vote
1 answer

How can I automate the process of adding iPhone to cart in Flipkart using Selenium(java),Page Object Model and TestNG? Also validate if product is added and available in cart?

Hey check this https://www.edureka.co/community/47160/automate-purchase-adding-book-cart-flipkart-using-selenium? It deals with a similar ...READ MORE

answered Jan 13 in Selenium by Karan
• 11,370 points
2,364 views
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,510 points
12,622 views
0 votes
1 answer

Identifying the page iframe in Selenium using Java Code

Open the page in a browser and ...READ MORE

answered May 24, 2018 in Selenium by Samarpit
• 5,890 points
421 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,510 points
3,127 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,890 points
2,362 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,890 points
2,507 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,360 points
113,738 views
0 votes
1 answer

Converting commands recorded in selenium IDE into Java

Yes, it is possible to do this. ...READ MORE

answered Jun 25, 2018 in Selenium by Meci Matt
• 9,460 points
1,085 views