Why is the element being tested (via protractor) clicked, but nothing happens? - selenium

I am using protractor v4.0.9 and node v6.8.1 (although I have also tested this issue on 4.6). I have a test that runs through a series of button clicks to get to a form. The code looks something like this:
browser.get('http://someurl');
// App select button
element(by.id('btn-select-app')).click();
// portal select
element(by.id('row-test-portal')).click();
// provisioning form button
element(by.id('btn-provisioning-form')).click();
This is then followed by a function that iterates through the form and fills it out. If I run the test from start to finish (including the function that fills out the form) it will fail when it tries to start filling out the form because it is on the wrong page - that is, even though the terminal is telling me it executed the click on the provisioning button, the form did not load.
If I shorten the test and run it only with the commands you see in the block above, it passes.
When I run it in debug mode I can execute the "element(by.id('btn-provisioning-form')).click();", but it doesn't appear to actually do anything - it will tell me it executed the the click, but the form does not appear on the page - I am still on the previous page. Note that the above test contains another button click prior to the click on the provisioning form button and that appears to work normally.
I have gone so far as to use different locators for the button including xpath and css but the nothing will get me to the provisioning form.
Button code
<div class="col-md-1">
<button id="btn-provisioning-form" ng-show="foo()"
class="btn btn-success glyphicon etc" ng-click="blah()"
aria-label="Provision" popover="Provision" popover-trigger="mouseenter">+</button>
</div>
Some other notes - I have managed to replicate the test using Selenium IDE and when I run that test from the Selenium IDE UI, it is able to click the button and get to the form. It looks like this issue is just being seen when I use protractor.
TL;DR : Protractor is telling me it clicked the button, but the button click isn't causing any change to the page. When I manually click the button outside of protractor, it works just fine. Why is this happening?

Instead of normal protractor click , try clicking through JavaScript code.

Related

Testcafe Browserstack IE11- Clicking on button doesn't work

Error: Button click doesn't perform action as expected, page is being Idle
Current behavior: It's clicking on a button but it's not performing any action
Expected behavior: Manually it works! expected the button click should move to the next page
Tried using Press key, hover, Client function for Selector
Unfortunately I couldn't provide more details of the application but I will appreciate providing workarounds
Seems like it was fixed in TestCafe v1.9.1.

How can I fix a button that is clicked but does not perform any actions?

So I'm currently working on a new project and I need to write some automated tests.
I came across a problem and I don't know how to fix it. If the button of my web page is clicked running selenium it doesn't perform any actions, but if I open the web page manualy and click on the button, everything works fine.
NOTE: I'm completely sure that the xpath is correct and the button is being clicked...
This is what happens running with selenium:
And this is what happens openning the web page manually and clicking on the button:

Selenium stops running after click() function runs

So I am writing a class in eclipse using selenium and autoitx4java libraries, now I have been having an issue that I believe is selenium specific (meaning having nothing to do with autoIt).
Basically when I arrive at the splash page for the website I am attempting to test, the first thing I do is find the element for the login page via XPath, and click on it using the click() method. This is supposed to open up a certificate window.
Once the click() method runs a certificate window comes up, however, for some reason the selenium test does not keep running lines of code. Instead it pauses at the line the click function was executed. The code looks a bit like this:
WebElement login = driver.findElement(By.xpath("example_xpath"));
login.click();
// login.sendKeys(Keys.ENTER);
System.out.println("login clicked");
Class.selectCert();
(Where "Class" is just a class created for this specific test.)
So when the code is run in Selenium, the line "login clicked" is never printed out. As you can see, the alternate sendKeys(Keys.ENTER) function has been tried. When I used this function, literally nothing happened, and the code continued as if that line of code did not exist.
Note: When I highlight the element and manually press ENTER, the certificate window actually pops up.
This is where things get weird. When I remove the line for the click function, and replace it with a pause() function which gives me ample time to click on the element manually. The code runs perfectly fine, the "login clicked" is printed out, and the certificate window is handled by the autoIt code I have in the selectCert() function.
I have tried clicking on different elements on the screen, and so far this bug only occurs when clicking on elements that have an xpath with /img at the end of it. Not sure if that helps at all... Any help would be appreciated!

Protractor won't press buttons in Windows

I have a series of protractor scripts that I've been running in Linux that work fine there for basic data input, button clicks, etc. Using those same scripts in Windows with firefox, protractor simply skips clicking the buttons. I have tried multiple ways to find the buttons (by.partialButtonText, by.css, etc) all of which work in Linux -- none of which work in Windows. Protractor does not complain that it can't find the button or can't see the button -- it just doesn't click it. I am using protractor 1.8.0 with firefox 31.2
I have now added Chrome and am running into similar issues. I found some other users having similar problems, and they put in waits between finding the element and clicking it. I can do that, but I don't understand why I should need to -- esp since that's not needed for Linux.
The button displays as: + Add Image
It should open a modal for the user to interact with.
<button class="btn btn-mini btn-primary" ng-click="imageEditMode=!imageEditMode"></button>
The following selects all work in Linux, but not when I run the script on the same firefox version in Windows.
element(by.cssContainingText('.btn-primary', 'Add Image')).click();
element(by.cssContainingText('.btn-mini', 'Add Image')).click();
element(by.partialButtonText('Add Image').click();
Just to reiterate, I don't get an error about the Add Image button. Protractor under Windows doesn't complain it can't find the element or that it isn't visible. But it does not open the modal.

PhantomJS click action not working on span when trying to login to Office365

I am trying to automate office365 operation, and try to login using phantomjs. I use sendEvent to send click to the span UI item (which happens to be the fake submit button). I use render to capture the screen-shot after sending the click event, and it seems the button is selected (greyed out) but never receives the click event.
I have a similar problem when trying to "click" this button with Selenium.
Has anyone ever successfully automated the office365 login? I guess this has something to do with the way the web page is structured. (There is another layer of javascript that receives the click event then redirect the user to the app page).
Is there any other tool that is better fit for such task? (I tried twill as well, and have no luck.)
I have a Selenium project that logs into Office365, but I've also had a lot of issues with being able to do it consistently. The CSS selector I'm using for the Sign In button is #cred_sign_in_button. If you look at the source, that is a span that has the click handler.
<span id="cred_sign_in_button" tabindex="11" **onclick="Post.SubmitCreds()**;return false;" class="button normaltext cred_sign_in_button refresh_domain_state" role="button" style="opacity: 1;">Sign in</span>
I've found that clicking on the button once doesn't work most of the time. I assume that's due to the animation happens when you hover over the button. What finally ended up working for me was to click, wait 250ms and click again.