SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Dec 2008
    Posts
    292
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Easy way to check random drop down box?

    Hey guys,

    Im having a bit of a problem with some code concerning drop down boxes

    I can very easily get the information from the drop down and allow it to be a random number - which was the original goal... but Im having an issue getting it to chose a random value while excluding one from the list.

    So for example, I have the following code:
    Var = Browser("").Page("").WebList("Drop down I want").GetROProperty("items count")
    Browser("").Page("").WebList("Drop down I want").Select "#" & RandomNumber.Value(0, Var - 1)

    This is working very well - the PROBLEM is - if I grab the first value (which is a default value) - usually labelled "ALL" but not always (usually has a tag with it) - it makes the rest of my script break because "nothing" is found on that drop down

    Ideally - I'd like to make it so that it would never chose the first option in the list. Im not sure how hard that is to implement.

    I found a work around but its really terrible. I've captured it again in an if statement and just get it to research if it hits the top one. This is really painful and I have quite a lot of if statements in the script - so I would need to do this with every one as they are all different variables.

    I apologize if this didn't make complete sense - long story short - I just need a way to randomize but also ignore the very first item from the drop down list (or the default value).

    Any idea's or suggestions? Thanks all in advance

  2. #2
    Member
    Join Date
    Nov 2009
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Easy way to check random drop down box?

    maybe I am missing something (it's late here :-) ) but
    RandomNumber.Value(ParameterNameOrStartNumber [,EndNumber])

    <snip>& RandomNumber.Value(0, Var - 1)
    so make the zero a one and you skip the first option....

    isn't that what you mean?

    R's
    R

  3. #3
    Senior Member
    Join Date
    Dec 2008
    Posts
    292
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Easy way to check random drop down box?

    [ QUOTE ]
    maybe I am missing something (it's late here :-) ) but
    RandomNumber.Value(ParameterNameOrStartNumber [,EndNumber])

    <snip>& RandomNumber.Value(0, Var - 1)
    so make the zero a one and you skip the first option....

    isn't that what you mean?

    R's
    R

    [/ QUOTE ]

    I can't believe I didn't notice that first.... such a noob I am.

    Thank you for the tip. I knew it was something painfully obvious I was doing wrong... That'll likely fix it up (Im trying it right now) [img]/images/graemlins/smile.gif[/img]

  4. #4
    Member
    Join Date
    Nov 2008
    Posts
    66
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Easy way to check random drop down box?

    We can add +1 to Random number

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:31 PM.

Copyright BetaSoft Inc.