I'm stuck trying to get my selenium testing to simulate a down arrow key press.
Im just using the html format for my tests and am using typeKeys as the command, the target is correctly found, and for the value I am putting in \40 which seems to be converted into \\40 in the UI. When I run the command it ends up appending \40 to the current value of the input.
I'm using the latest version of the selenium ide from the site.
Any pointers?
Cheers
Selenium provides its own methods for this task.
Try using keyDown() instead of typeKeys()
Related
i'm using selenium IDE for automation testing, i tried to use keypress on selenium, but because my site blocking any click and can only use keyboard for operating, i cant use sendkeys() to run it with selenium IDE because the empty target, is that possible to use sendkey without target? or is that another way to press key without target?
thanks for helping.
In regular Selenium you can sendKeys without a target web element with Actions.
As I see here this can also be done with Selenium IDE.
There are more additional documentations and tutorials about this.
Yes you could use ActionChains in regular Selenium, as mentioned in the previous answer. This definitely will work. But I am needed to use Selenium IDE.
A work around might be executing some JavaScript with the execute script command in Selenium IDE to trigger the key press that you need. That might work. I have found some code snippets online for that, but haven't yet worked it out. Actually I'm surprised that there's not a simpler solution.
I recently started using robotframework with the Selenium2Library. I haven't tested using Selenium before, but I know it is possible to record tests using Selenium. In RobotFramework, it says, "it is not possible". I mean even for a simple login test, I need to write the test, specifying the id of username, password and submit button.
However, is there any way by which these tests can be recorded using robotframework? such as clicking on a text box, entering a string and then clicking on submit button etc., and automatically generate the test case source code instead of having me to write the test cases. Is this possible with robotframework or any external library that it supports?
robotframework wasn't designed to be a record-and-play tool, and has nothing built-in to support that.
There was someone who wrote a selenium IDE plugin that would generate robot keywords, but that was years ago. The github repository is here: https://github.com/denschu/selenium-ide-format-robotframework
The code hasn't been touched since 2012, so I doubt it's of much use.
Using this Firefox add-on, FireRobot we can generate most of the code and also using this you can select the elements on the screen and get related code suggestions on right click like
Wait Until Element Is Visible
Click Element
and all operations to perform on the selected element.
I am using the Selenium IDE extension for testing webpages in FireFox and I was able to find out how to perform almost every command that I need to automate testing for my webpage.
Unfortunately I was not able to find out how to do this through the list of commands that you can manually enter into the queue of Selenium IDE.
I was wondering if anyone knew how to do this in the Firefox extension. Thanks!
You can use dragAndDropToObject command which locates the target element and drags it to the centre of the destination element.
dragAndDropToObject
target: locator of the element to drag
value: locator of the destination element
There is also a dragAndDrop command which drags the element by specified amount of pixels and drop it.
For one thing, you might want to use Selenium Builder instead of Selenium IDE. Also, there are some things that Builder or IDE cannot record, such as iFrame interactions, certain AJAX actions, and also drag and drops. For those, you need to code them by hand afterwards and get them working.
I have a link on a page which only appears when hovering over a certain element. But I can't figure out how to emulate this and then click on the link so I can cucumber test it using Capybara and Selenium.
Anyone know how to do this? I've tried executing javascript and and also trying to talk to the selenium driver directly but so far I'm not having much luck...
This question is a few years old, so the answer might have changed. In newer versions of Capybara there are a few different ways to do it, depending on the driver you're using.
For selenium, you can execute javascript:
page.execute_script '$("#element").trigger("mouseover")'
Newer versions of selenium-webdriver support a hover method:
find('#element').hover
For capybara-webkit, the driver supports triggering events on the element:
find('#element').trigger(:mouseover)
I originally found the answer to this question from here and here.
Use Selenium's fireEvent on a mouseover event and then pause for your required hover time.
I have worked on similar one i used following see this might help you.
Using Selenium IDE.
1. Navigate to the required page.
2. Start selenium IDE and Get the Link target.
3. Change the Command to mouseOver Double click the the command in Selenium IDE.
4. It will Show the link wchich you needed.
5. Again Start recording and record the required Link.
When you Double click the mouseOver command it creates the simulation of mouse over through IDE and you can Use your mouse to record the popup link.
Thanks
I finally succeeded in getting Capybara + the Selenium driver to "hover" over an element. This is the code I'm using:
module Capybara
module Node
class Element
def hover
#session.driver.browser.action.move_to(self.native).perform
end
end
end
end
I am using Selenium-python script for web test automation. When ever I use selenium inbuilt commands, I will get Attribute error during run time.
Ex: selenium.WindowFocus("preview_email") throws "AttributeError: class selenium has no attribute 'WindowFocus'"
I am new to test automation. Help me to sort out this problem.
The command that you are looking for is selenium.window_focus()
I have never used the Python client personally, but a quick glance at the selenium.py file reveals that there is a window_focus command which gives the currently "selected" window focus ("selected" in Selenium terms is the window that Selenium is currently executing commands against and not necessarially the window that has user focus).
Executing the select_window command with a window ID will set tell Selenium which window you want to execute commands against.
I have had some trouble w/ popups in general and the way the Selenium IDE and RC clients attempt to locate new windows and/or there parents. Good luck.
I think you want to force web-driver to go to another window with name "preview_email".
For this purpose, you need to use selenium.switch_to_window("preview_email"); because selenium.window_focus() just gives focus to the currently selected window and accepts no arguments. Additionally you used it in JAVA mode (I mean selenium.windowFocus()).