I am using Selenium to give rating to some video.
The page source for the rating is:
<img src="/images/largeRating0.png"
alt="Rating"
title="Choose a rating then click to submit"
class="clickable"
id="ratingImage"
onmousemove="rEngine.mouseMove( event, this );"
onclick="rEngine.ratingSubmit( event, this );" />
I am giving the parameters in code for Selenium like this:
selenium.open(url);
selenium.click("id=ratingImage");
It's doing the process and giving the rating too, but it's only giving 1 star for every rating I do!
The rating is for 5 stars and when the mouseover
is done on the image of rating, it gives the /images/largeRating1.png; /images/largeRating2.png; /images/largeRating3.png;
etc..
Every image contains the number of stars.
By default as mentioned above it is <img src="/images/largeRating0.png" ...
Is there any process for accessing Javascript for getting desired results?
If I understand it correctly, you need to press your mouse button and move it? If that is the case, then this should be of help:
selenium.dragAndDrop("id=ratingImage","+100,0");
...or some combination of selenium.mouseOver()
and selenium.mouseDownAt()
.
Otherwise, you can of course invoke the javascript yourself, you just need to understand which arguments to pass to it. Use
selenium.getEval("rEngine.mouseMove(dontknowwhat, window.document.getElementById('ratingImage'));");