Is selenium a specific language oriented (like Java)?

Issue

I am new to Selenium. After searching for tutorials and references, I found most of them are based on Java, specially the WebDriver part. I know JavaScript, will that be useful with Selenium?

Solution

Yes, the Selenium WebDriver (the part that lets you automate a web browser) is available for Javascript as an NPM.

Here is their example of use.

var webdriver = require('selenium-webdriver'),
    By = webdriver.By,
    until = webdriver.until;

var driver = new webdriver.Builder()
    .forBrowser('firefox')
    .build();

driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
driver.quit();

Answered By – Schwern

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published