I cannot get sendKeys Enter or Return or a simple .click to work on a button

OS: Windows 8
Selenium Version: 2.53.0
Browser: Internet Explorer
Browser Version: 11.0.9600.18321

Expected Behavior – I expect the login button to be clicked when using sendKeys Return/Enter or using .click

 

Actual Behavior – Page refreshes

 

Steps to reproduce –

Here is a snippet of the code, firstly let me apologize if this is a coding issue as I am new to Selenium and Java but I would expect the login button to be clicked but the page just refreshes, I have tried sendKeys(Keys.Return) as well as a simple .click(). I also perform a negative test where the username and password are incorrect and this seems to work as it shows the expected incorrect username and password warning in the application. I have also attempted different ways of identifying the element with the .click() method but to no avail.
I should also state that when clicked manually the user is logged into the application.
Pom Class file:
//Set user name in textbox
public void setusername(String strusername){
username.sendKeys(strusername);
}
//Set password in password textbox
public void setpassword(String strpassword){
password.sendKeys(strpassword);
}
//Click Login button
public void clickLogin(){
loginbutton.sendKeys(Keys.ENTER);
}
public void loginToApplication(String strusername, String strpassword){
//Fill user name
this.setusername(strusername);
//Fill password
this.setpassword(strpassword);
//Click Login button
this.clickLogin();
}
This is then called in the Test Class file:
//Log into the application
LoginPage.loginToApplication(“”,””);

Add Comment
  • 1 Answer(s)

    I have pinned this down to an application issue as it works against a different version of the application with the same configuration, browser, OS, etc.

    Default Answered on May 19, 2016.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.