- hhoang
- Posts : 2
Join date : 2011-07-26
Selenium 2 Webdriver cant find element by xpath after upgrading from firefox 3.6 to 5
Tue Jul 26, 2011 11:34 pm
I have a test which will click on a description box
and type in a quick description. Before upgrading Firefox, the test would work fine. Selenium 2 would click on the box and would type in the description. however, after upgrading to firefox, I'm now receiving an "unable to locate element" error. It seems like Selenium2 is clicking on the textarea(I can see the cursor blinking inside the box), but it's not actually typing anything in.
Here's a copy of the code I'm using in selenium2, using Java:
The first and third textareas are hidden, so i use the contains() to
select the second textarea. This was working fine until the update.
and type in a quick description. Before upgrading Firefox, the test would work fine. Selenium 2 would click on the box and would type in the description. however, after upgrading to firefox, I'm now receiving an "unable to locate element" error. It seems like Selenium2 is clicking on the textarea(I can see the cursor blinking inside the box), but it's not actually typing anything in.
Here's a copy of the code I'm using in selenium2, using Java:
- Code:
WebElement venueDescription = driver.findElement(By.xpath("//iframe[contains(@id,'Frame')]"));
venueDescription.sendKeys("This is a description for the Venue");
The first and third textareas are hidden, so i use the contains() to
select the second textarea. This was working fine until the update.
- Code:
<input id="cf_textarea1311363997499___Config" type="hidden" style="display:none" value="LinkBrowserURL=%2FCFIDE%2Fscripts%2Fajax%2FFCKeditor%2Feditor%2Ffilemanager%2Fbrowser%2Fdefault%2Fbrowser.html%3FConnector%3D..%2F..%2Fconnectors%2Fcfm%2Fconnector.cfm%26_cf_clientid%3D242D1F3D48B023DBFB61177D36938485&LinkUploadURL=%2FCFIDE%2Fscripts%2Fajax%2FFCKeditor%2Feditor%2Ffilemanager%2Fconnectors%2Fcfm%2Fupload.cfm%3F_cf_clientid%3D242D1F3D48B023DBFB61177D36938485&ImageBrowserURL=%2FCFIDE%2Fscripts%2Fajax%2FFCKeditor%2Feditor%2Ffilemanager%2Fbrowser%2Fdefault%2Fbrowser.html%3FType%3DImage%26Connec...e%3DImage%26_cf_clientid%3D242D1F3D48B023DBFB61177D36938485&FlashBrowserURL=%2FCFIDE%2Fscripts%2Fajax%2FFCKeditor%2Feditor%2Ffilemanager%2Fbrowser%2Fdefault%2Fbrowser.html%3FType%3DFlash%26Connector%3D..%2F..%2Fconnectors%2Fcfm%2Fconnector.cfm%26_cf_clientid%3D242D1F3D48B023DBFB61177D36938485&FlashUploadURL=%2FCFIDE%2Fscripts%2Fajax%2FFCKeditor%2Feditor%2Ffilemanager%2Fconnectors%2Fcfm%2Fupload.cfm%3FType%3DFlash%26_cf_clientid%3D242D1F3D48B023DBFB61177D36938485&AutoDetectLanguage=false&DefaultLanguage=en">
<iframe width="0" scrolling="no" height="0" frameborder="0" src="javascript:void(0)" style="position: absolute; z-index: 10000;">
<iframe width="0" scrolling="no" height="0" frameborder="0" src="javascript:void(0)" style="position: absolute; z-index: 10000;">
<iframe width="0" scrolling="no" height="0" frameborder="0" src="javascript:void(0)" style="position: absolute; z-index: 10000;">
<iframe width="0" scrolling="no" height="0" frameborder="0" src="javascript:void(0)" style="position: absolute; z-index: 10000;">
<iframe width="0" scrolling="no" height="0" frameborder="0" src="javascript:void(0)" style="position: absolute; z-index: 10000;">
<iframe width="0" scrolling="no" height="0" frameborder="0" src="javascript:void(0)" style="position: absolute; z-index: 10000;">
<iframe id="cf_textarea1311363997499___Frame" width="675" scrolling="no" height="200" frameborder="0" src="/CFIDE/scripts/ajax/FCKeditor/editor/fckeditor.html?InstanceName=cf_textarea1311363997499&Toolbar=BasicText">
<textarea id="cf_textarea1311363997499" name="description" style="display: none;"></textarea>
- hhoang
- Posts : 2
Join date : 2011-07-26
Re: Selenium 2 Webdriver cant find element by xpath after upgrading from firefox 3.6 to 5
Wed Jul 27, 2011 2:14 am
So after playing around with Selenium2, i discovered that it wasn't working because the editor was in a seperate iFrame.
So i implemented the following code, and it works:
However, now i'm having trouble figuring out how to return to the main page, so that i continue testing.
Is there an easy way to do this?
So i implemented the following code, and it works:
- Code:
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(@id, 'Frame')]")));
driver.switchTo().frame(driver.findElement(By.xpath("//iframe")));
driver.findElement(
By.xpath(
"html/body/p"
)
).sendKeys("This is a description for the Venue");
However, now i'm having trouble figuring out how to return to the main page, so that i continue testing.
Is there an easy way to do this?
- Unable to find an element by Id, Name or Xpath using the Webdriver of IE for my webpage
- How to find the exact element usnig xpath
- How to find the element name for Login page or any other in Firefox?
- how to find element by attribute in webdriver
- Unable to find element with id selenium internet explorer C#
Permissions in this forum:
You cannot reply to topics in this forum