Chandiran
Chandiran

Reputation: 11

Unable to click button - Watir

The button on a page has the following code:

<a onclick="return ValidateAll();" id="btnSignin" tabindex="5" href='javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnSignin", "", true, "Login", "", false, true))'>Sign In

my code: ie.button(:id,"btnSignin").click does not throw any error yet does not click the button

How to make the button click?

Upvotes: 1

Views: 1619

Answers (3)

Željko Filipin
Željko Filipin

Reputation: 57262

My guess would be that you need to fire JavaScript event. To find out which event should be fired read How to find out which JavaScript events fired?

Without a lot of experimenting, this could work:

browswer.link(:id => "btnSignin").fire_event "onclick"

Upvotes: 2

juan2raid
juan2raid

Reputation: 1644

Your code has a typo in it.

ie.button(:id,"btnSigin").click

Should be:

ie.button(:id,"btnSignin").click

Upvotes: 1

John
John

Reputation: 6612

Your button is a hyperlink, so try this: ie.link(:id, "btnSignin").click

Upvotes: 1

Related Questions