How to automate iframe click in selenium-ide? - selenium

Also, the simple click command to the skip_intro id is failing.

Please use the selectFrame command in Selenium IDE to select the frame.
If your iframe is like <iframe id="ntbanner" width="100%" scrolling="no" height="113px" frameborder="0">
Your command will be selectFrame and the corresponding target will be id=ntbanner in IDE.
Once you are in the frame, you can click the button or elements in the frame by using normal click. If you want to get back out of the frame you can set target as null to the selectFrame command in IDE

Related

selenium IDE displays hidden div then immediately closes it

I have a hidden div element that when I click the link the visibility changes. In my Selenium IDE script I click the link and I see the div open but then it immediately closes. The rest of the scripts run, but in a demo I would like to keep that div open.
My steps are:
click [Link that shows hidden div]
-->It is here that it displays and then immediately hides it.
focus [element inside div]
assertValue [target element]
Is there a setting that I need or a step that needs to be added?
It's hard to suggest. But there are some things that you can try.
First of all maybe your div is going to hide when link is not under
the mouse. Than you can use mouseOver
Maybe if you need just to verify variable you do not need even see
the div. Selenium IDE can take the value from element that is not
visible. It is not a fare play but sometimes you can do it.
Another way is to use javascript to bring your div to the light:
getEval | window.document.getElementById('your_divs_id').set_attribute('style','');
The most brutal and not trustable way to try to do it to add command
getEval | window.stop()
right after the click.

how to scroll down in another frame in selenium IDE?

I have to scroll down to load some contents in selenium IDE. But It's not in the current window. It's subframe. How do I do that?. I know this command works with current window.
<td>storeEval</td>
<td>selenium.browserbot.getCurrentWindow().scrollTo(200,200)</td>
<td></td>
Select the required frame using selectFrame(locator) command, here locator is an element locator identifying a frame or iframe. Then try to execute your scroll command.

How to click on the text after scroll down in Selenium IDE

The web page that I am using has a list of links
My use case is to perform page down operation and select the link at that location.
I performed page down using the following command
storeEval with the Target as selenium.browserbot.getCurrentWindow().scrollTo(0,20000)
The above action performs the page down
My next action is to click the link that is shown
I used the command clickAtAndWait with the target link=target_link
The above action clicks the text target_link at the top of the page (which is not visible) and not the text that is visible.
I need to perform page down and click the text target_link that is visible.
What change needs to be performed for this action?
In the Selenium IDE you can use the Command focus with a Target value of an element at the bottom of your page.
For example:
Command: focus
Target: id=nextButton1
Value:
This will scroll the Selenium IDE (Firefox) window down so the "Next Button" is just visible at the bottom of the screen. The Value parameter is not used and has been left blank.
You need to find the element and then use the click command.
Sample code:
elem1 = driver.find_element_by_class_name("wtb-search-submit")
elem1.click()
Read at http://selenium-python.readthedocs.org/en/latest/locating-elements.html on how you can locate the element. Hope it helps.

Automating "Browse" button event in Selenium

I need to automate the "Browse" button click from Selenium.
For this, I have tried
driver.findElement(By.xpath("//*[#id=\"dnn_ctr383_View_filename\"]")).click();
and
driver.findElement(By.cssSelector("Css path")).click();
Both gives me org.openqa.selenium.NoSuchElementException: Unable to locate element: exception.
I have seen this link here where the author suggest to use AutoIT, but in step 2, the script, the author has created is for IE. Can someone please suggest, how I can automate the "Browse" button click in firefox?
Any help is much appreciated.
Directly send the file path to the id, like so
driver.findElement(By.id("dnn_ctr383_View_filename")).sendKeys("C:\\path\\to\\file");
The above step is the answer for your first two steps
Click on Browse
Select a file to upload
For the third step(click upload), looking at the screen capture I do not see any button which says "Upload". So just click "Save" and I assume that your file will successfully get uploaded.
There are two things that u need to consider here:
Clicking the browser button: Usually handled by an alert or popup, if the driver is not able to find the element by xpath(which u have acquired from firebug or chrome's inspect element) you should consider looking for iframes in the page source. If an element is in a different frame altogether , u need to switch frames in order to find the element like this
WebElement frame = driver.findElementById("name_of_iframe");
driver.switchTo().frame(fr);
now you can find your element using xpath or css selector like u did. Once completed u can move out of the frame by:- driver.switchTo().defaultContent();
Uploading the file from desktop: Since selenium works only on the html in the browser session u invoked from the driver, it can't perform operations on your desktop.Once you are able to click the browser button u can use Auto it(works only on windows) or Sikuli(works with mac, linux, windows and even android) to simulate your events based on the position of your upload button.
Hope this helps

click on script generated div in selenium

i am trying to click on a div like
[//div[24]/div/div/div/table/tbody/tr/td[3]/div/div[2]/div[2]/div[5]/div/div] .. although selenium verifies this div by verifyElementPresent and xPath is shown in xPath finder but click function of selenium does not click on it ..
selenium opens a page, i click on Customers link, script generates all the customers, then click on Details, script generates the detail page,. there i have to click on the div (Save button actually ) mentioned above ... any solution for this ???
try runScript and fire the click event with javascript
e.g. if you have jQuery on the tested script
<!--fire awkward click event-->
<tr>
<td>runScript</td>
<td>$('.bo-selector').click();</td>
<td></td>
</tr>