Selenium commands not working on confluence wiki Page table. Any Help ?

314 views
Skip to first unread message

Raju

unread,
Sep 18, 2012, 1:24:36 AM9/18/12
to seleniu...@googlegroups.com
Hi

In our project, we create WIKI pages using confluence. Now for we decided to log our selenium smoke test results on WIKI page. I created WIKI page and i created a table in WIKI page where i want to write the test result based on the test run.Using selenium i am able to log in CONFLUENCE and able to navigate to WIKI page properly, and i am able to CLICK the EDIT page button (which will make page available in EDIT mode ) also, But after that, selenium is not able to identified the TABLE cells ( XPath is proper ) to write the result. Test is going down saying not able to identified the element. I am not sure why Selenium is not able to identified that Table cell, it has clear Xpath. I tried recording the same script Using selenium IDE to see what IDE is recording, But even Selenium IDE also not recording that part ( i.e. type something in cell ), If i keep the XPATH in IDE to find the element, it is being highlighting it properly but not recording.Not sure how to handle. If anyone has any suggestions please share.

Thanks

Raju

unread,
Sep 18, 2012, 2:00:59 PM9/18/12
to seleniu...@googlegroups.com
Just an update. Today morning i found that, After clicking EDIT button on CONFLUENCE PAGE, It is becoming iframe, I think that is the reason selenium commands are not working. So i started using SELECTIFRAME commands first before typing text into Table cell. But not able to select the iframe properly. Tried below way's so far.

selenium.SelectFrame("xpath=//*[@id='xxxxxxxxxxxxxx']")        but not selecting the frame properly.

Tried Webdriver selectFrame like below, still not selecting .....researching further, if any one has inputs please share.

driver.switchTo().frame( "xpath=//*[@id='xxxxxxxxxxxxxx']" )
WebElement  x = driver.switchTo().activeElement();
x.findElement(By.xpath( "xpath=//*[@id='xxxxxxxxxxxxxx']" )).sendKeys("1234").

Thanks

Raju

unread,
Sep 18, 2012, 3:46:21 PM9/18/12
to seleniu...@googlegroups.com
  Update -

  Now i am able to select the iframe properly and able to click at the table cell location also, But not able to type anything :( in there, trying different options ( JavaScripts etc)..but not working...

driver.switchTo().frame("wysiwygTextarea_ifr");
WebElement editable = driver.switchTo().activeElement();
WebElement cell1 = editable.findElement(By.xpath("//*[@id='tinymce']/table[1]/tbody/tr[2]/td[2]"));
editable.findElement(By.xpath("//*[@id='tinymce']/table[1]/tbody/tr[2]/td[2]")).click();
global.Sleep(4000);  // custom function.
new Actions(driver).moveToElement(cell1).perform();
editable.findElement(By.xpath("//*[@id='tinymce']/table[1]/tbody/tr[2]/td[2]")).sendKeys("123456"); 

but test is failing saying - "Failed to send keys because cannot focus element"   

Some how it is not able to focus. That's the reason i kept Click before at least it click in that location, click is working, but not sendkeys. Tried different javascript functions also, but not working. 

Browser :- Chrome.  If i run the same test on Firefox browser then script is passing but it is not typing anything in that cell.

Any help will be appreciated. 

// JavascriptExecutor js = (JavascriptExecutor) driver;
// String script = "document.getElementByXpath('//*[@id='tinymce']/table[1]/tbody/tr[2]/td[2]').setValue('123456')";
// js.executeScript(script);
//((JavascriptExecutor) driver).executeScript("arguments[0].setAttribute('value', '123456');", cell1);

Raju

unread,
Sep 19, 2012, 1:25:49 AM9/19/12
to seleniu...@googlegroups.com
Update:-

SendKeys is not working. Only CLICK and Clear are working not sure why it is not working. It is saying focus element failed. below is the stack trace ?  Finally i did some minor work around for this, but that is not a good solution ( just time being solution ).  any work around  or suggestions on this ?  ( JavaScripts , Jquery etc...) ?

=========================================================================================
org.openqa.selenium.WebDriverException: focusElement execution failed;
 Failed to send keys because cannot focus element (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 125 milliseconds
Build info: version: '2.2.1', revision: '16551', time: '2012-04-11 21:42:35'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.7.0'
Driver info: driver.version: RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:175)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:245)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:88)

=====================================
Reply all
Reply to author
Forward
0 new messages