I'm testing a website using selenium web driver C#. My intention originally is to check the HttpWebResponse that returns 200. However, the button is a javascript onclick event. I'm wondering if anyone has past experience about how to deal with this situation. Here's the HTML for the button:
<td>
<input id="ctl00_ContentPlaceHolder1_ExportPACEButton" type="submit" tabindex="-1" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$ExportPACEButton", "", true, "", "", false, false))" value="Export as PACE File" name="ctl00$ContentPlaceHolder1$ExportPACEButton"/>
</td>
Try something like this:
public void JavaScriptClick(IWebElement element)
{
IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;
executor.ExecuteScript("arguments[0].click();", element);
}
And driver is the driver you used in other place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With