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.
Related
I've a strange problem since yesterday, I've made an update of Symfony and since I don't have the debug toolbar anymore. It is displayed in my html code like this :
<div id="sfwdtd14ed8" class="sf-toolbar sf-display-none" data-sfurl="/_wdt/d14ed8" style="display: none;">
Here is my web profiler config :
web_profiler:
toolbar: true
intercept_redirects: false
My config is good and I can display the debugger with url like this :
http://127.0.0.1:8000/_profiler/latest?ip=&limit=10
I can't find any solution if you could help me thank you.
Updating the Symfony Client to latest version (4.5.1) resolved the issue, which was probably the "broken Symfony WDT", fixed in 4.4.5.
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
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!
Using Selenium, with an earlier combo of the webdriver (2.28.0) and Firefox (pre-19), the following code worked.
driver.get("http://www.haemonetics.com/en");
driver.findElement(By.linkText("LOGIN")).click();
driver.findElement(By.linkText("Haemonetics")).click();
With webdriver 2.31.0 and Firefox 19.0.2 the code does not work and I receive a NoSuchElementException for the second findElement.
I tried using xpath which doesn't work for Firefox but does work for Chrome and IE, which are part of the same test suite.
Any thoughts or another way to accomplish the same thing? I would prefer to use the same code for the mentioned browsers.
Not sure if it was a typo on your part, but it should be "find_element" instead of "findelement", at least it's so in 2.31 to my knowledge.
Try
driver.find_element_by_link_text("LOGIN")
if that doesn't work, post your HTML code so we can possibly construct a working Xpath.
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.