What is Selenium

Selenium Interview Questions

Circle Gallery

Shooting

Racing

" });

Bottom

» » Selenium Interview Questions Part 3


Q. What are the different types of locator's in Selenium?
Ans:

  1. ID
  2. ClassName
  3. Name
  4. TagName
  5. LinkText
  6. PartialLinkText
  7. Xpath
  8. CSS Selector

Q. When do we use findElement() and findElements()?
Ans:
  • findElement(): findElement()is used to find the first element in the current web page matching to the specified loctor value.
          Syntax: WebElement element = driver.findElements(By.xpath(*//div[@id='example']//ul//li*));



  • findElements();findElements() is used to find all the elements in the current web page matching to the specified loctor value

      Syntax: List<WebElament> elementList = driver.findElements(By.xpath(*//div[@id='example']//ul//li*)):

Q. What is the difference between driver.close() and driver.quit command?
Ans:

  •  close(): Webdriver's close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the webdriver. The command neither requires any parameter nor does is return any value 


  •  quit(): Unlike close() method, quit() method closes down all the windows that the program has opened. Same as close() method, the command neither requires any parameter nor does is return any value 

Q. What is Difference between getAttribute() and getText()?

Ans: 
  • getAttribute() method is useful to read element's attribute value like id, name, type etc.
  • getText() method Is useful to read text from element or alert.

About Unknown

Selenium Tutorial for Beginners from Selenium Real Time Industry Experts
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply