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]