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.
Related
I'm using Selenium IDE 2.9.1 to automate my regression test cases.
Normally when running Selenium IDE in Firefox, if you right-click on a browser element - whether it's text, a button, a field, etc. - a list of potential commands comes up. This had been the case for me as of last week.
This morning, however, I'm finding that right-clicking in the browser does not show the commands anymore. This is making writing my test scripts a lot slower.
Can anyone tell me why this might be happening, and/or how to fix it?
A similar question was asked (Can't see Selenium IDE commands on mouse click), but it was never answered. So I'm asking here.
I had a similar problem - no "Show all available commands" when right clicked on object. A downgrade to firefox to 50.1.0 helped.
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 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've got a rather Javascript-heavy page with lots of contents generated via AJAX or other scripts. On some of these elements Selenium can record mouse clicks, while on others it ignores them. I haven't found any correlation. Perhaps there are some known common scenarios where Selenium cannot intercept mouse clicks?
Unfortunately not all clicks in Selenium are equal. Some are mouseDown and MouseUp or a variation on that. I would play around with that to get your app working.
Unfortunately Selenium IDE has been misrepresented. It is a Record/Tweak/Playback tool not a record/playback tool.
There's no list of actions that are unreliable. In my experience there's no pattern to which elements work, but it's consistent throughout executions of the test. In case you were thinking about it, playing around with locators or UI-Elements is very unlikely to improve your results.
I recently had a situation with a number of dropdown menus, all implemented in the same way, on multiple different pages. On certain pages, dropdown #2 and #3 wouldn't work, yet on other pages they would work, but dropdowns #1 and #2 wouldn't.
As has already been pointed out, the best thing to do is stop thinking about Selenium IDE as a record-playback tool.
On a sidenote, you may be asking this question for a similar reason I was, which was wanting to use Selenium IDE as a frontend for teammates without Selenium programming experience to create tests with, then one thing I did find helpful was extending the Selenium IDE by adding a Command Builder, which allows you to control what appears in the right-click menu when using the IDE.
This means you can press record, go about recording your test as normal while keeping an eye on what has been recorded. Once you see Selenium IDE has failed to record an action, you can just right-click the element and the action you wanted to record will be easily available.
Not a solution to your original question, but it's helped me out. It's very simple to write an extension to the right-click menu, there's some really good examples on this Selenium website.
I'm a 100% selenium noob, but I had the same problem and solved it through the following workaround:
Right-click the to-be-clicked item
Choose a random command that has the entire locator text, e.g. assertText //div[2]/div[5]/table/tbody/tr[1]/td[1]/div IR or something. Look inside "Show all available commands" too.
In the Selenium IDE, change the command to "click" and remove the 2nd argument (the Value field; if any)
Hacky, and should be easily improved with a custom command in the right-click menu, but for now this works fine for me.
Did you try clickAt with location (0,0)? It sometimes helps
If you have assigned an ID to the element you want to click I would suggest you try a simple script, you can perform this through the IDE:
runScriptAndWait
jQuery("#yourButton").trigger('click');
I have used this in the past and it works just fine.
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()