Friday, February 12, 2016

Alternate for descendant



//descendant::img[@alt= 'Actions'][1]

 or 


(//img[@alt= 'Actions'])[i]
descendant not works in chrome browser ...
 

Monday, August 31, 2015

How Set text editor value using selenium Webdriver [selenium webdriver with 'HTML text editor']

 WebElement iframe = driver.findElement(By.xpath("//iframe[@id=\"pt1:USma:0:MAt5:1:pt1:AP2:reg1:0:r2:0:rte5::cont\"]"));
       driver.switchTo().frame(iframe);

       WebElement description =driver.findElement(By.cssSelector("body"));
       JavascriptExecutor js=(JavascriptExecutor) driver;
      
       js.executeScript("arguments[0].innerHTML = '<h1>
Sample text </h1>'", description);

Thursday, August 27, 2015

Finding first node in xpath result set

Here we are getting 9 matching table(nodes) .I want to select one by one using descendant function in xpath

/descendant::table[@summary="My Directs' Performance Documents" ][1]
 

Thursday, November 6, 2014

How to select a value from Calendar using Selenium Webdriver

 


First  need find css for calendar object

css=label[id='flight-departing-label']>span.icon.icon-calendar.

driver.findElement(By.cssSelector("input#flight-type-roundtrip")).click();

1. Verify month

 driver.findElement(By.cssSelector("div.cal>section.cal-month:first-of-type>header>h2")).getText();

It will return the month  Nov 2014

2.Select the day 

driver.findElement(By.cssSelector("div.cal>section.cal-month:first-of-type>ul>li>a[data-day='6']")).click();

3. Clicking next month like Jan 2015

driver.findElement(By.cssSelector("button[class='btn-paging btn-secondary next']")).click();