Tag Archives: automation interview questions

general selenium questions

1. Find element using xpath and cssSelector. Html code: <a class=”shopicon relative”>Shopping</a> Solution:  //a[@class=’shopicon relative’]   –> using xpath in firefox .shopicon.relative   –> using cssSelector in chrome //a[text()=’Shopping’] –> text() method 2. In the “in.rediff.com” website, ways to find NEWS link are: Using cssSelector: .navbar>:nth-child(1)>:nth-child(2) .navbarul>:nth-child(2) Using xpath: //a[text()=’NEWS’]   Related articles: Waits in Selenium WebDriver

selenium-interview-questions-2

Selenium Interview Questions: 1. Question on xpath. Parent child traversing. Lets consider we have 1 parent element and 3 child elements. Write a xpath to identify the 2nd child element using 1st child element? Selenium Testing Selenium WebDriver Selenium Automation Solution: //*[@id=’id1′]/following-sibling::li[1] Explanation: If you give the xpath ‘//*[@id=’id1′]‘ in firepath or chropath, 1st child… Read More »