Keyword "Click Element" doesn't always work correct - selenium-rc

I'm facing problem, that keyword "Click Element" doesn't always work correct.
For example, I want to go to the link on the web-site.
xpath for the Link is the:
${xpathIMButton} xpath=//a/span[contains(text(),"${exprIM}")]
${exprIM} Infrastructure Management
To click on the Link with Mouse Over I use following:
Wait Until Page Contains Element ${xpathIMButton}
Mouse Over ${xpathIMButton}
Click Element ${xpathIMButton} don't wait
That's pretty simple, but what I see on the Logs is confusing:
The screenshot from HTML-source of the button:
So, the Robot finds the link (Wait Until Page Contains Element and Mouse Over) are OK, but the Click Element fails. On the screenshot I can see, that the button actually exists. So what is the problem? Why I get those confusing error?
I'm using:
RFW 2.7.5
SeleniumLibrary 2.8.1
Firefox 12

Try this:
Wait Until Page Contains Element ${xpathIMButton}
Mouse Over ${xpathIMButton}
Click Element ${xpathIMButton} don't wait

Click Element started to fail for me when I upgraded to Selenium 2.35, SeleniumLibrary 2.9.1 and Selenium2Library 1.2. My browser was Firefox 22. The Click Element was pressing a Save button. The same exact code worked 2 times and the third time said it worked but the confirm page never showed up. I solved my issue by putting a Focus keyword before my Click Element
Focus ${saveRule}
Click Element ${saveRule}
Now the code works the three times it is called. Hope this helps.

It may be a little late to provide an answer, but I had exactly this problem. What I did was to provide a bit waiting time for the page to fully load, then my button was successfully found.

It seems that your Mouse Over could cause the issue. The Mouse Over could cause the element to be hidden in DOM.
But this was 6 years ago with Selenium 1 Library. Now, we are using Selenium2Library in ROBOT Framework, so if you give a try or already done it, just let us know.

Related

Protractor screenshot of open select box not working

Next in my list of protractor woes:
I have a case where I click on a select element and hover over the empty choice at the top, and grab a screenshot of that. Or at least I try. It grabs the screenshot, no errors, and moves on. However, not with the select box open. Just a closed select box.
What am I missing? Here's the snippet:
createPage.userid.click();
// Take screenshot of page
browser.takeScreenshot().then(function (jpg) {
writeScreenShot(jpg, 'screenshots/deleteUser.jpg');
});
I've tried a few other things I've found on here like trying to click it open, and then hovering the option, etc. but nothing works.
EDIT:
Something I've noticed that may have to do with this. When I let the browser run behind an open other window, when the dropdown opens, it shows up in front of said window, totally detached from the browser. Which reminded me of one of those key concepts I learned when I was a wee web developer that dropdown menus are given a z-index pretty much above everything else when they open. Could it simply be that protractor can't see the open dropdown because it's so "high up"?

selenium capybara, hover menu skip animate show

I have a website need test e2e, in each case, I must hover the main menu for sub-menu showing, then click goto next step.
Because only click sub-menu success after menu is hovered in 1.5 seconds, So every time I want to goto next page, I must pay 2 seconds for waiting sub-menu showing and click it.
Is there others ways to work around it? My test case running really slow now
Thanks :)
You have a couple of options: If it's your sites code set the activation time for your sub-menus to be much shorter when run in the test environment. If not - what exactly are you testing? If you're testing that the menu works then you'll just have to live with the delay. If however you just want to test that the links in the menu go to valid places you could find the hidden menu entries, get the destinations, and visit them directly
visit(find_link('Sub-Menu entry text', visible: :all)['href'])
It really does depend on what your testing environment is and what exactly you're trying to test.

Firefox Web Developer Tools - how to see the code associated with a button

I'm not really sure how to best word this, but let's say I'm on a web page and when I click a certain button, something undesirable happens. Like a whole bunch of content disappears. Is there a way in the Firefox debugging tools where I can insert a watch on that button so when I click it, the debugger will pause the JS execution and show me exactly where in the code it's executing the stuff I don't want?
(note: obviously this is code I did not write, otherwise I'd know where to look to fix the problem)
Yes, in the debugger there is an events pane, and you can break when a specific event is triggered. The documentation is here:
https://developer.mozilla.org/en-US/docs/Tools/Debugger#events-pane
Firefox has a good built-in profiler - you can click the start profile, and click it again to end, and see what parts of the code are running the most.
This is really helpful in finding performance problems too.

Start Firebug when radio button is clicked

I have a complicated mess of code (built by a team of 7 over the course of several years) that incorporates multiple libraries - jQuery and angularjs, specifically.
I know that the value of a variable changes when I click a certain radio button, but I have no idea what is running when that happens to cause the variable to change. I've tried console.log in every place I can think of, but am somehow still missing the action that's changing the variable.
I know how to debug with Firebug if I know where to place my breakpoint, but in this case, I don't. Is there any way to tell Firebug to start debugging at the line that executes immediately after the radio button is clicked? In other words, when I click the radio button, open Firebug's Script panel to the first line in order of execution, wherever that line may be.
If you have chrome you can right click on the checkbox -> inspect element -> event listeners
Is there any way to tell Firebug to start debugging at the line that
executes immediately after the radio button is clicked?
Yes, this feature is called Break On Next.
Note that Firebug has much more features to debug your scripts besides setting breakpoints within the Script panel. These features are described in the 'Script Debugging' page inside the Firebug wiki.
Furthermore the Watch side panel allows you to inspect the variable to see, at which step it is changed.

VB6 - View Code will not display code

This is probably a really dumb question but i'll ask anyway.
I was wondering if there was any reason as to why a form wouldn't display its code when i click "view code" from the right click context menu in vb6?
It was working awhile ago so i'm kind of stumped.
Thanks
If forms are still not visible, try Window -> Cascade - This was the way I goit my forms visible again.
Maybe it is being displayed under something else. Check under the Window menu. Do you see it there?
Does the form display if you right click and select 'View Object'? If so, try double clicking on the form - that should display the source. You might also check the permissions to the file.
This is an old question, but since it's the first link retuned by a Google search, answering here may help many people.
Like someone else said, Window/Cascade does the trick, but with time it becomes annoying.
I have the same problem on my laptop with an external display. Closing the laptop cover (thus going back to only one display) fixes the issue.
An alternate way is to display the VB6 IDE on the main display (your main display is the one with icons on the bottom right corner). You can set your main display under System Preferences/Displays. There's a checkbox called "make this one the main display", it does not need to be your monitor #1.
Problem does not seem to occur if you have 2 displays side-by-side. Also, the fact that my laptop's resolution is not the same as the external display's resolution may cause the issue.
After taking these steps, you may have to restart the VB6 IDE to fix the issue.

Resources