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,080 points
13,219 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, 2020 in Selenium by Karan
• 19,610 points
7,789 views
+1 vote
1 answer

How to automate instagram login page using java in selenium?

Try the following: package com.company; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import ...READ MORE

answered Sep 15, 2020 in Selenium by Karan
• 19,610 points
6,406 views
0 votes
2 answers

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

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 6, 2020 in Selenium by Sri
• 3,190 points
18,431 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,577 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,559 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,606 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,506 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
193,704 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
2,220 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