4

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?

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
Aspirant
  • 2,238
  • 9
  • 31
  • 43

1 Answers1

1

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'));");
Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
  • 1
    Hey thanks @Slanec for the code !! i need to perform `selenium.ClickAt("id=ratingImage","50");` to get the exact result of rating !! anyway your code helped me to think about the location to click at and now its working fine :) – Aspirant Apr 03 '12 at 05:33
  • Hey i am using selenium to buffer a song which makes a count for each play i am playing !! but here the problem is using selenium is working fine to play the song !! but its not incrementing the count every time !! even though i do it for 10-20 times the count is increased for only 1 !! SO i think i have to rotate the proxy to make the increment in count , hence can you suggest me any idea regarding proxy config in selenium other than `System.setProperty("http:proxyHost","111.11.11.111"); and System.setProperty("http:proxyPort","1111");` because its not working !! Can u help me out !! Thanks.. – Aspirant Apr 03 '12 at 07:35