Unable to "click" in recent webdriver release on FireFox - firefox

I am facing intermittent issue in Clicking on a button or a hyperlink on Firefox.
I am using webdriver version 2.27 and FF17.
The buttons are simple html button -
<input class="btn" type="button" title="AddP" onclick="navigateToUrl('/p/tyy/SelectSearch?addTo=006y67&retURL=%2F00999yu2Boy9','MM_LIST','addP');" name="addP" value="Add P">
I use locator as : name=addP
For hyperlinks I use locator as : link=hyperlinktext
The Click will not fail with any exception, it will simply highlight the button or link, but not perform the actual click.
The frequency of failure is once in 3 times.
Thanks
Sky

Upgrade to at least Selenium 2.28. There were some bugs for Firefox 17 before that.

Here is what i found :
Issue 1: I was using By.linkText("test test").click which should have been By.partialLinkText("test test").click . Thanks to stackoverflow for the answer.
Issue 2: I rewrote the css locators for failed button to start from class of some parent above.
For e.g. instead of
css=input[name='j_id0:j_id2:j_id3:j_id4']
I am now using
css=.individualPalette input[name='j_id0:j_id2:j_id3:j_id4']
And it works all the time. I am not sure why??
I am still to rerun my scripts couple of more times to be sure these helps.

Related

Ruby Cucumber: Selenium Webdirver - IE 11 link flashes, cannot click on

I am experiencing IE browser links flashing issue when I run test automation written in Ruby Cucumber using Selenium WebDriver.
Scenario: Navigating to Reporting home page.
Given I see menu Reporting available.
When I navigate to "Annual Reporting".
Then I see the correct header on Annual Reporting page.
home_page.rb (Approach 1: using page_object)
link(:annual_reporting_link, :id => 'annualReportingLinkId')
def go_to_reporting
mouse_over_home
wait_until(5) do
annual_reporting_link
end
end
Result: Could not click on the link because of the link flashing.
Then I tried the following (Approach 2: Using send_keys)
#browser.find_element(:id, 'annualReportingLinkId').send_keys :return
and
#browser.find_element(:id, 'annualReportingLinkId').send_keys(KEYS.ENTER)
but it did not work either. I am getting this error when run the test:
Selenium::WebDriver::Error::ElementNotVisibleError: Cannot click on element
The HTML:
<div id="homeMenu">
<ul>
<li class="has-sub"><a class="homeButton" href="/report-web"></a>
<ul id="homeLinks">
<li id="report1LiId"><span id="report1LinkName" class="disabledLinksText">Report 1</span></li>
<li id="report2Id"><span id="report2LinkName" class="disabledLinksText">Report 2</span></li>
<li id="annualLiId"><span id="annualReportingLinkName">Annual Reporting</span></li>
<li id="administrationLiId"><span id="administrationLinkName" class="disabledLinksText">Manage Users</span></li>
</ul>
</li>
</ul>
</div>
Test automation is able to expend the home menu, which contains sub-menus - hyperlinks. But after mouse_over_home (the home menu), the sub-menu started flashing. I need to click on "annual_reporting_link" to go to this reporting page, but because of flashing, the test automation cannot click on it at all.
Anyone has a solution that worked for you? Please share your solution.
Environment:
Ruby: 1.9.3
Cucumber: 2.1.0
Selenium Webdriver: 2.53.4
page-object: 1.2.0
IE: 11
I've had this issue before using Selenium Webdriver and IE. I found that it was a bug between my version of IE and Selenium Webdriver.
When I experienced this problem, I put a break-point before the link was clicked and debugged the test, I then manually tried to click the link in IE and I was still unable to do so 9 times out of 10 because of this bug, the link was simply ''flashing'' and unresponsive.
I'd recommend upgrading your version of Selenium Webdriver to version 3.0.0, that should fix the problem.
If you don't want to make the jump to Selenium Webdriver 3.0.0, You need find out the exact version of IE 11 you're using. Try to upgrade or downgrade your version of IE 11, this should also fix the problem, but you may find you're stuck on a version of IE 11 until you upgrade to Selenium Webdriver 3.0.0.
Antoher solution is to set the persistent hovers to false within your IE profile, something like this:
profile = Selenium::WebDriver::IE::Profile.new
profile['enablePersistentHover'] = false
driver = Selenium::WebDriver.for :IE, :profile => profile

New firefox + firebug breaks select2 in wrapbootstrap pixel-admin theme

I'm getting a TypeError: elem.dispatchEvent is not a function using select2 in jquery using the wrapbootsrap pixel-admin theme.
It can be reproduced in firebug on the demo site via http://radiant-ocean-4606.herokuapp.com/forms-advanced.html
Firefox Version: 29.0.1
Firebug Version: 1.12.8
It's a similar error message to this question:
"element.dispatchEvent is not a function" js error caught in firebug of FF3.0
But the answer there doesn't help me as my site is all jquery (well as far as I know - I did somewhat accept the theme bundle as it came for the time being until I have time to really rip it apart and modify it in detail).
This was caused by changes to the browser, the solution was to stop using firebug. The features firebug offered are ubiquitous now!

Form not submitted on click using watir-webdriver in Chrome

I am using ruby/cucumber/watir-webdriver and the page-objects gem to run my tests. My tests are usually run in firefox but decided to give chrome a try. While the click works in firefox it does not in chrome. Here is the sample html code:
<form id='test-form' method='post' class='validate-inline'>
...
<div class='margin-top'>
<input class='btn' data-disable-with='wait...' type='submit' value='Submit Form'></input>
</div>
</form
In my class page I have the button declared as the following:
button(:submit_form_btn, :value => 'Submit Form')
And call it this way:
submit_form_btn_element.when_present.click
I do see the button text change to 'wait...' for a few seconds then returns to 'Submit Form' but does not seem to submit the form. As mentioned before it works with firefox and when clicked manually. Just seems to be an issue in Chrome. Any ideas how to get around it?
I tried clicking the div, and tried clicking the button twice but same issue.
As always your help is appreciated. Thanks.
I know this question is little old now, but I thought I'd post in case this helps anyone.
Most of the times I've run into similar issues, it was caused by an update to Chrome that caused issues with the version of the watir-webdriver gem (or one of it's dependencies) or with the version of chromedriver that I was using. I've had success in the past by updating my gems and chromedriver and the other times I've had to roll back the browser version to the previous release.
It's not ideal to be testing on an older version of chrome but it worked fine as a stop gap until the issue was fixed.
If you do go for the previous version of chrome approach, make sure to log a bug ticket if there isn't already one there.

Invalid Xpath 2 error for 'Click' selenium function

I have ran a test using Selenium IDE 2.3.0 and copied the Junit4/Remote control script into the Eclispe Classic 4.2.2 and started running my code as 'Junit4'.
I see the following error:
Invalid Xpath 2
The selenium command in Eclipse for Xpath is:
selenium.click("//input[#value='Search Equipment']");
I tried copying the Xpath using Firebug which was:
/html/body/section[2]/section/div/div/div/form/div[2]/div[2]/div/span/input
But I get the same error.
start selenium record and enter some thing to ur textbox or if its a button click the button then click stop.you can get the correct xpath by going to target in the relevant step in selenium IDE.use last xpath.
As per your question, i understood that you need to click on the button "SearchEquipment".
So try with this xpath :
selenium.click("//span[#id= 'rba-keyword-submit']/input")

Watin support for IE 9 - Part 2 (Specific)

Watin Runtime Version: v2.0.50727
Browser: IE 9
I have found a specific issue:
BaseIEController.IE.Element(fieldname).Exists throws an Exception as under:
"It's not possible to find the element because no element finder is available."
The fieldname here is a Regex for a link, a simple Regex where the Link's Id is passed.
This works with IE 8.
I cannot use the Final Release of Watin 2.0 since the LogonHandler is not complete (not fully functional as mentioned in the Release Document. I have tried testing it as well).
Any idea on how I can get this Element thingy to work??
Thanks,
K
Today I have upgraded to IE9 on my windows 2008 system and run all the 745 WatiN 2.x unittests and found no issues (accept for one dialog handling the javascript::return dialog fired by onbeforeunload event).
Let me know if you have more specific info/ code example will help too to reproduce the issue you reported.
Jeroen
Lead dev WatiN
Thank you for the response. Firstly, Awesome job with Watin :)
I am trying to run the test using VS2008 and IE 9. The goal is to Click a Link but before that I am verifying if the Link is exists.
The Regex I use for this link is LnkSignIn = new Regex(".*linkSignIn$");
I then use BaseIEController.IE.Element(fieldname).Exists where the fieldname is an Attribute Constraint (in this case the Regex). This would return a true or false if the Link is found. If found, I then click the Link. Instead it returns the Error MyTestInitialize threw exception. WatiN.Core.Exceptions.WatiNException: WatiN.Core.Exceptions.WatiNException: It's not possible to find the element because no element finder is available.. at WatiN.Core.Element.WaitUntilExistsOrNot(Int32 timeout, Boolean waitUntilExists)
...
This works just fine with IE 8. Further, I noticed that if I change Element to Link, it returns true. But since this is a generic method, I want to keep it as element. Hope this helps. Please let me know if you need more information. Thanks.

Resources