2

I am a beginner with Selenium. I user Selenium IDE 1.9.0 for recording website activity. For example I am trying to record some activity involving an online product creation. Consider the website "demo.soft2print.com/products.asp" Here, i click on any product. It opens an IFrame wherein i can design the product. Selenium IDE does not record anything from the point the IFrame has loaded(even loading of the IFrame). When viewed in the "Source" tab in Selenium IDE, the following is the last that has got recorded(i.e when i click on a product)

<tr>
<td>clickAndWait</td>
<td>css=a.productgrouplink</td>
<td></td>

Please help on how to proceed recording IFrame acitivity(loading and related acitivity in the IFrame) using the Selenium IDE. It would be nice if i get to know how to proceed with reference to the website i mentioned. Awaiting for some help.

Mufaddal
  • 5,398
  • 7
  • 42
  • 57
Bomzinho
  • 161
  • 1
  • 7
  • 14

2 Answers2

3

As what I had posted here.

Here's a solution that worked for me:

Scenario:

  1. Page loads with a JavaScript that adds an iframe to the DOM <iframe id="iframeId" />
  2. iframe loads
  3. Now I want to check for an element within the iframe <div id="divElement"></div>

Solution:

(Command > C, Target > T, Value > V) If I didn't include, it means leave it blank

  • C: open   |   T: /
  • C: waitForElementPresent   |   T: iframeId   |   V: 3000
  • C: waitForFrameToLoad   |   T: iframeId   |   V: 5000
  • C: selectFrame   |   T: iframeId
  • C: assertElementPresent   |   T: css=div#divElement
  • C: verifyElementPresent   |   T: css=div#divElement
Community
  • 1
  • 1
Calvin
  • 1,305
  • 8
  • 17
  • Thanks. I managed to detect the IFrame by using C: waitForElementPresent | T: iframeId | V: 3000 However, as in the IFrame i have a flash file playing where-in i have to detect the clicks of certain buttons in Selenium ide. I tried to right click on the Flash file in my iframe to view the source, but in vain. Can you please specify a way to detect click of controls of a flash file within the Iframe. – Bomzinho Jun 12 '13 at 07:40
0

I know it's quite a bit later, however I found what I think is a simpler solution that works with selenium 2.5.0 (which apparently as of writing, has a known issue-bug causing it to not record iframe activity, see here : https://code.google.com/p/selenium/issues/detail?id=6180 ) Solution for me while running selenium IDE, was to simply open the iframe in a new tab, and recording worked, as follows:

  • right click on iframe you want to record actions on, from the menu
  • select -> this frame -> open in new tab
  • Selenium IDE should start recording actions ( woo hoo! )
  • ... do your stuff, click click type type etc
  • when finished, close tab, continue on main page, selnium ide should be ok?

I'm a sample size of 1, not seen much on google on this topic so this might not work for you. Please drop a comment either way to let others know? cheers, A

snowcode
  • 1,033
  • 10
  • 24
  • Ah, just realised,of course you'll still need to manually edit the final script to change frames, my "answer" was only addressing how to get Selenium to actually record the iframe actions. I'm using FluentAutomation, which has a wrapper around Selenium that allows me to switch to an iframe using I.Switch.Frame("main"), I then paste in the recorded bits for the iframe actions. – snowcode Jun 15 '14 at 21:58