71. How to get a text of a WebElement?
Answer: By using getText() method.
72. How to clear the text in the text box using selenium web driver?
Answer: By using clear() method.
73. How to get an attribute using selenium webdriver?
Answer: .getAttribute(value) method.
74. How to click on a hyperlink using selenium ?
Answer: We use click() method in selenium to click on the hyperlink
Ex: driver.findElement(By.linkText(“BJS”)).click();
75. How to submit a form using Selenium Webdriver?
Answer: We use the “submit()” method on element to submit a form.
Ex: driver.findElement(By.id(“form_1”)).submit();
Alternatively, we can use click() method on the element which does form submission.
76. How to press Enter keys on a text box in selenium?
Answer: To press ENTER key using selenium webdriver, we need to use Selenium num Keys with it’s constant ENTER.
Ex: driver.findElement(By.xpath(“xpath”)).sendKeys(Keys.ENTER);
driver.findElement(By.xpath(“xpath”)).sendKeys(Keys.TAB);
77. Is Selenium Server needed to run Selenium WebDriver Scripts?
Answer: We need to use Selenium Server only when we are distributing our Selenium WebDriver scripts to execute using Selenium Grid.
78. What happens if the following command is run? driver.get(“www.bangalorejobseekers.com”);
Answer: An Exception is thrown. We need to pass “http://” protocol within driver.get() method.
79. What is the alternative to driver.get() method to open an URL using Selenium?
Answer: Alternate method to driver.get(“url”) is driver.navigate.to(“url”).
80. Difference between driver.get() and driver.navigate.to(); in Selenium?
Answer:
driver.get(“url”): To open an URL and it will wait till the whole page gets loaded.
driver.navigate.To(“url”): To navigate to an URL and it will not wait till the whole page gets loaded.
hi,your blog is very useful. all the questions are so challenging. thank you for posting all important questions.
http://www.trainingpune.in/selenium-training-in-pune.html