0
votes

I am trying to automate login process for a website. In the login screen, we have username, password and login button. This login button will be enabled only when both username and password are entered.

While recording via selenium IDE,the button is getting enabled. But when i try playing the testcase, I am getting exception as '[error] Element xpath=(//ul[@id='main-nav']/li[3]/a/img)[2] not found'

I tried researching about this issue and there were suggestions to use 'sendKeys', 'fireEvent'.. But nothing works for me.. Please help me to resolve this issue..

Link : Selenium Test Case Screenshot with code and exception

1
Can you please provide the URL, we can get better chances digging with it. - user3872094

1 Answers

1
votes

How do you enable the login button? Probably it's by javascript, but how exactly? The event onChange is calling a javascript function?

What you could do is execute the command "runScript" calling this function to enable the login button.

Update:

Taking a better look at your image, I realize 3 things:

1 - You're calling the change event before the sendKeys. So, you're triggering the change event with blank fields. Try to put the change event after sendKeys.

2 - Why are you using sendKeys? Did you try to use simply "type" command? Probably it would trigger the change event, since it emulate the typing itself.

3 - The error is "Not Found". It doesn't mean that the button is disabled, but the IDE can't find it. Considering you're using xpath, are you sure you're getting the proper xpath? It's an image and, if you're hiding the disabled image and showing the enabled image, the position can change, making the IDE to not find your button. Try to get by ID or CSS, for example.