winwell 1 Posted May 12, 2013 Report Share Posted May 12, 2013 I am on a web page which takes product reviews. It has a box to add text and 2 sliders to rate different things. The text box is easy enough but I can't work out how I can get ubot to click and drag the sider to a random position. Here's the appropriate HTML: <div class="question" id="itemScoreQ"> <h3><span style="float:left;" id="scoreText">2</span>Now rate it out of 10</h3> <div id="slider" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"><a class="ui-slider-handle ui-state-default ui-corner-all ui-state-focus" href="#" style="left: 20%; "></a></div> </div> <div class="question" id="itemValueQ" style=""> <h3><span style="float:left;" id="valueText">£5 - £275</span>and what is it likely to cost</h3> <div id="slider2" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"><div class="ui-slider-range ui-widget-header" style="left: 0%; width: 54.54545454545454%; "></div><a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 0%; "></a><a class="ui-slider-handle ui-state-default ui-corner-all ui-state-focus" href="#" style="left: 54.54545454545454%; "></a></div> </div> <div class="question" id="sendResult" style=""> <button onclick="submitReview();">Submit</button> </div> In the above example the first slider is id=scoreText which has a value of 2. (That's what I moved the slider to). If I moved it to 6, the value would be 6 and so on. I want to be able to select a random value between 1 and 10 on the slider. The next slider is the itemValueQ which in the above example has a value of £5 - £275. Again i want to be able to select random values between the upper and lower limits. This slider has two slider buttons one to set the lower end of the cost and one to set the upper end of the cost so you end up with a cost range between x and y. If I could get ubot to click on a random part of the slider that would suffice. Maybe I could look into clicking on coordinates to see if that works. But does anyone know how to emulate clicking/dragging the slider behaviour? Thanks Quote Link to post Share on other sites
merkaba 36 Posted May 12, 2013 Report Share Posted May 12, 2013 Appears it might be a slider from a jquery library (jquery ui). I can't confirm this, it's just a guess on the naming they did in the class. Demohttp://jqueryui.com/slider/ API documentationhttp://api.jqueryui.com/slider/You should be able to pass a value that way using the run javascript command.Just check the page for a script reference to jquery ui to confirm. Quote Link to post Share on other sites
winwell 1 Posted May 12, 2013 Author Report Share Posted May 12, 2013 Thanks I'll do a bit of digging around Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.