Tuesday 9 February 2016

Identify the following web elements

Q)Identify the following element by using cssselector:
==========================================

<input id='1' class='abc' type='value'/>

1.using class
   webDriver.findElement(By.cssSelector(".abc"));

2.using id
   webDriver.findElement(By.cssSelector("#1"));

3.cssselector
   webDriver.findElement(By.cssSelector("input[id='1']"));


Q)Identify the following element

<div - -  >
  <td id=1>selenium</td>
  <td>selenium</td>
  <td>selenium</td>--------->identify this element
  <td>selenium</td>

xpath:
------------
//td[@id='1']/following-sibling[2]

Q) <div id="identifier-shown">
     <input >
     <input >------>identify this element

xpath:
----------
//div[@id='identifier-shown']/input[2]

No comments:

Post a Comment