Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

O hai SQA, first post here.

I just started using Selenium a few days ago. However, I'm a little stumped getting it to work with one of my projects.

I have an HTML file containing a collection of images. Each image has an event handler, which calls a JavaScript function when I click the image, or press Enter after selecting it with the arrow keys.

However, Selenium doesn't recognize any interaction (mouse clicks or key presses) with the images no matter what I do, although I can get it to work with other sites. The "collage" is JavaScript-generated as opposed to being coded in pure HTML, although I'm not sure if that makes a difference. Any help would be appreciated.

share|improve this question
    
Since you have started with Selenium, can you try Selenium 2 (aka WebDriver) API for click operation - seleniumhq.org/docs/03_webdriver.html –  Tarun Aug 13 '12 at 5:35
    
I have faced an issue similar to this before? Check out this question: sqa.stackexchange.com/questions/1039/… –  Suchit Parikh Oct 13 '12 at 22:12
add comment

1 Answer

how is the event triggered? does the element have an attribute say onclick?

another way to trigger javascript is to use the following example, which is more of a workaround.

WebDriver driver; // Assigned elsewhere
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return document.title");
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.