Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

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