I'm trying to call an existing javascript function on the page but I'm not getting it.
This is the element I have:
<area shape="rect" coords="513,0,580,66" href="#" onclick="document.f2.submit();">
This is the call:
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript("document.f2.submit()");
Exception:
unknown error: Cannot read property 'submit' of undefined
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7601 SP1 x86_64)
How can I perform this operation normally?
js.ExecuteScript("setTimeout(function() { document.f2.submit(); }, 1000);");? the idea is to execute the script after some time to ensure that everything is "in place"