Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

» Selenium Webdriver
Sat Feb 04, 2017 6:47 pm by soumyamishrav@gmail.com

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Selenium 2 Webdriver cant find element by xpath after upgrading from firefox 3.6 to 5

View previous topic View next topic Go down

Selenium 2 Webdriver cant find element by xpath after upgrading from firefox 3.6 to 5

Post by hhoang on 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:

Code:
  WebElement venueDescription = driver.findElement(By.xpath("//iframe[contains(@id,'Frame')]"));

  venueDescription.sendKeys("This is a description for the Venue");
Here's a copy of the HTML code i'm trying to test.
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

Back to top Go down

Re: Selenium 2 Webdriver cant find element by xpath after upgrading from firefox 3.6 to 5

Post by hhoang on 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:
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?

hhoang

Posts : 2
Join date : 2011-07-26

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum