You can fire events in Selenium 2:
WebElement element = driver.findElement(By.id("myElement"));
JavascriptLibrary javascript = new JavascriptLibrary();
javascript.callEmbeddedSelenium(driver, "triggerEvent", element, "blur");
You can also execute any JavaScript you want to execute:
JavascriptExecutor jsexec = (JavascriptExecutor) driver;
jsexec.executeScript("return alert('Hello world!');");
The only thing you need to remember when using executeScript is that it must return something.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/teqVzsKml7wJ.
For more options, visit https://groups.google.com/groups/opt_out.
It’s been around as long as I can remember, a least a year? (Unless my memory is going with age…)
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/O-MVFW-0nWQJ.
Daniel
Interesting ... but (using your example) surely clicking on the field with ID someField should at least trigger the onclick event of that field, rather than having to click some other field?
I can see that many events, such as "blur" might not trigger until some other field gets the focus.
Peter