Which programming language is highly used in Selenium

0 votes
I would like to know which is the best language for writing tests in Selenium WebDriver, Can anyone help me with an example?
Apr 25, 2018 in Selenium by GandalfDwhite
• 1,320 points
32 views

1 answer to this question.

0 votes

Java is most widely used programming language in Selenium. Other than Java there are other languages too like Python, Pearl, PHP, Ruby, and so on.

Below is an example to login to  Facebook using Selenium-java:

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) {

// TODO Auto-generated method stub

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 25, 2018 by Meci Matt
• 9,420 points

Related Questions In Selenium

+1 vote
1 answer

What is locators used for in selenium?

Locator are used to find and match ...READ MORE

answered Dec 18, 2018 in Selenium by Nabarupa
38 views
0 votes
1 answer

What is TestNG and why it is used in selenium?

Hello @User, Talking about TestNG, it is an ...READ MORE

answered Dec 24, 2018 in Selenium by Shuvodip
88 views
0 votes
1 answer

What is Apache POI in Selenium and what it is used for?

Hi Raj, Apache POI is the most commonly ...READ MORE

answered May 8 in Selenium by Abha
• 23,030 points
237 views
0 votes
1 answer

What is Robot Class in selenium webdriver and why it is used?

Hello Akanksha, Robot Class is used for those ...READ MORE

answered May 8 in Selenium by Pratibha
• 2,780 points
158 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,090 points
577 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
898 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
565 views
0 votes
1 answer

Which is preferred more in Selenium Absolute or Relative XPath

Absolute XPath is the direct way to ...READ MORE

answered Apr 20, 2018 in Selenium by Meci Matt
• 9,420 points
1,050 views
0 votes
1 answer

Selenium WebDriver typing speed is slow in input text field

It worked for me in the 64bit ...READ MORE

answered Jun 1, 2018 in Selenium by Meci Matt
• 9,420 points
2,598 views