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>
Related
I am trying to use Selenium IDE to enter text in a TinyMCE text field, and have come across some code that seems like it will work, but so far it's only half-working.
What I have is:
...
<tr>
<td>selectFrame</td>
<td>id=message_ifr</td>
<td></td>
</tr>
<tr>
<td>runScript</td>
<td>document.getElementById('tinymce').innerHTML="I am typing into the Draft Section, I hope";</td>
<td>Editor</td>
</tr>
...
When I run the first command, it selects the iFrame, but nothing happends when I run the second command, nothing happens. However, when I click the 'Find' button on the target, the text is entered in the TinyMCE text area, so it looks like it's working on some level.
Anyone see where I'm going wrong?
Code came from this page:
https://groups.google.com/forum/#!searchin/selenium-users/ide$20tinymce/selenium-users/0FBmA6TUQ4s/2kaAdeU7CgAJ
It is tricky to enter text into TimyMCE text boxes. There are two steps involved in handling this task using selenium.
Switch to the frame in which the text box is present
Using Javascriptexecutor to enter the text into the same.
Please refer to the similar link in stackoverflow.
How to input text into tinceMCE editior using selenium/webdriver
Hope this helps.
This is ugly but it will work (based on the example at https://www.tinymce.com/)
<tr>
<td>runScript</td>
<td>tinymce.setActive(tinymce.get('mce_0'));tinyMCE.activeEditor.setContent('<h1>some text</h1> TinyMCE');</td>
<td></td>
</tr>
And if you're wondering what id to use (in this example in the .get I used mce_0) you can click into your tinymce text box and then run this in the console: tinymce.activeEditor.id;
I'm new to selenium so I've been using the IDE to create tests. I have this problem where Selenium sees a button associated with a drop down menu, but it won't click the button. To get around this i want Selenium to type the URL (for the button i want clicked) into the address bar of fire fox, or I want selenium to just go to said URL via some command, but i can't find said command, and i can't get Selenium to click and type in the address bar.
You can use open command and type the expected url. Just right click on the command window and Insert New Command and follow the screenshot. However, you should find a better way to click the button instead.
I found the open(url) command after i posted this.
The open command would be the way to go here, but might I reccomend also adding in a store command, rather than having the script reference the URL directly. If for any reason the URL on the button changed it would mean amending the script, however if for example you went with
<tr>
<td>storeAttribute</td>
<td>id=Button-Locator#href</td>
<td>url</td>
</tr>
<tr>
<td>open</td>
<td>${url}</td>
<td></td>
</tr>
It would mean less upkeep on the script in the event of URL changes
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
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.
I'm using Selenium IDE on this website: http://sg.sensemaker-suite.com/collector/modifyfragment.gsp
to do data-driven entry using an XML file.
My test suite runs a loop using data from the XML file where it:
1. Enters the user name, project, language, and the ID. Clicks "load fragment"... loads and page numbers pop up.
2. Click "16" and waits to load.
3. Enters text in a field and then final click to "save modified fragment".
4. Captures a successfully entered alert.
I've created the test suite and it appears to be working when I watch it run on FireFox. Everything gets entered properly and clicked and it loops properly to the end. However, when I go back into the database, the data I entered isn't there. Could it be my last click and alert capture are incorrect?
<tr>
<td>waitForElementPresent</td>
<td>name=ModifyFragment</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=ModifyFragment</td>
<td></td>
</tr>
<tr>
<td>assertAlert</td>
<td>Your entry saved successfully</td>
<td></td>
</tr>
I've tried different last methods ClickAt, MouseOver, MouseDown, MouseUp. Nothing works.
When I enter everything manually, it works. However when I use Selenium to do everything but the final click and then click it manually myself, it doesn't register in the database. Any ideas on what else I can try?