0

I want to execute javascript using selenium.

JavaScript code on UI:

<input id="rbSingleFuture" class="rfdRealInput" type="radio" onclick="javascript:setTimeout('__doPostBack(\'rbSingleFuture\',\'\')', 0)" value="rbSingleFuture" name="PaymentTypeGrp" _rfddecoratedid="_rfdSkinnedrbSingleFuture"></input>

My code:

IJavaScriptExecutor js = (IJavaScriptExecutor)_webDriver; js.ExecuteScript("onclick=javascript:setTimeout(__doPostBack('rbSingleFuture',''), 0);"); 

This does not clicks on the radio button.

    1 Answer 1

    1

    Try this

    IJavaScriptExecutor js = (IJavaScriptExecutor)_webDriver; js.ExecuteScript("document.getElementById('rbSingleFuture').click();"); 

    Source: http://www.w3schools.com/jsref/met_html_click.asp

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.