Selenium Automation MCQ test


Self-evaluation test on selenium automation for interview preparation. This self-assessment test will help analyze the person's expertise in automation using Selenium with Java.


Selenium automation MCQ test

The test consists of 6 questions

No negative marking for this test.

No Time limit

The pass percentage is 70%

The correct answer with a description will be displayed after the answer has been marked.

Submit the test to calculate your score once you are done with all the questions.

Complexity Level- Moderate







Q1.Analyze the below code and identify the output:

public class abc {

static WebDriver d;
public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
d=new ChromeDriver(options);
d.get("https://www.google.co.in");

}
}














Q2: Analyze the below code and identify the output:

public class abc {

static WebDriver d;
public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
d=new ChromeDriver();
d.get("https://timesofindia.indiatimes.com/");
JavascriptExecutor js = (JavascriptExecutor) d;
js.executeScript("window.scrollBy(0,document.body.scrollHeight)");
}
}
















Q3. Analyze the below code and identify the output:

public class abc {

static WebDriver d;
public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
d=new ChromeDriver();
d.get("https://timesofindia.indiatimes.com/");
WebElement e= d.findElement(By.xpath("//h3[@class='_21aP6 _2jikr ']"));
JavascriptExecutor js = (JavascriptExecutor) d;
js.executeScript("arguments[0].scrollIntoView();", e);
}
}
















Q4: Analyze the below code and identify the output:

public class abc {

static WebDriver d;
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
d=new ChromeDriver(options);
d.get("https://timesofindia.indiatimes.com/");
}
}

















Q5: What will be the result of the execution of the below code?

public class abc {

static WebDriver d;
public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
d=new ChromeDriver();
d.get("https://google.co.in");
WebElement e= d.findElement(By.xpath("//input[@class='gLFyf gsfi']"));
d.navigate().refresh();
e.sendKeys("selenium");
}
}

Here, the web element e refers to the search field.
















Q6: Identify the output of the execution of the below code:

public class abc {

static WebDriver d;
public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
d=new ChromeDriver();
d.get("https://google.co.in");
d.navigate().refresh();
WebElement e= d.findElement(By.xpath("//input[@class='gLFyf gsfi']"));
e.sendKeys("selenium");
}
}

Here, the web element e refers to the search field.






























  • Join our telegram channel
  • Quantitative aptitude - practice tests


    A series of aptitude practice tests comprising multiple-choice questions (MCQ) on varied aptitude topics that evaluate the quantitative ability.