Pages

Search This Blog

Wednesday, October 6, 2010

How to verify value in drop down list.

How to verify value in drop down list.
We somehow manage to find the element on the page but its difficult to fund element with some specific attributes.
Take an example How to find some value is in drop down list or now? To find element drop down is easy but to find a drop down having some specific
value in their list is difficult.

Go to www.ebay.in you will see there is drop down along with search text box.
How to veify a specific value "Collectibles" is in drop down list.

Using Xpath:

<tr>
 <td>verifyElementPresent</td>
 <td>//select[@id='_sacat']/option[contains(text(),'Collectibles')]</td>
 <td></td>
</tr>

verifyTrue(selenium.isElementPresent("//select[@id='_sacat']/option[contains(text(),'Collectibles')]"));


Using CSS:

<tr>
 <td>verifyElementPresent</td>
 <td>css=select#_sacat>option:contains("Fun")</td>
 <td></td>
</tr>

verifyTrue(selenium.isElementPresent("css=select#_sacat>option:contains(\"Fun\")"));

<tr>
 <td>verifyElementPresent</td>
 <td>css=select>option:contains("Fun")</td>
 <td></td>
</tr>


How to select the value in drop down using regular expression.

There are situation when we need to select the drop down value with some partial text .
With the help of regular expression we can select the drop down value

<tr>
 <td>select</td>
 <td>_sacat</td>
 <td>label=regexp:Fun*</td>
</tr>

selenium.select("_sacat", "label=regexp:Fun*");


47 comments:

  1. Hi Niraj,
    Very Very usefull Blog. Frankly speaking i am learning selenium thru your website.
    I have one dount.
    in ebay.in if u need to find the xpath of categories i.e. for ex: Watches under categories. How to find?

    Thanks,
    Sudbhir Bhat

    ReplyDelete
  2. Sorry for late reply.
    In fact we have to find category drop down element. And all the list in drop down will be known by its label.
    so first using xpath we will find th drop down to locate this.
    xpath=//select[@id='_sacat']
    then with the help of label will find out the watches category.
    label=Watches

    <tr>
    <td>select</td>
    <td>xpath=//select[@id='_sacat']</td>
    <td>label=Watches</td>
    </tr>
    or
    selenium.select("xpath=//select[@id='_sacat']", "label=Watches");

    let me know if dint find any luck on that

    ReplyDelete
    Replies
    1. Hi Niraj,
      Very Very usefull for me...
      Thanks

      Delete
  3. Spot on with this write-up, I really believe this amazing site needs far
    more attention. I'll probably be back again to see more, thanks for the information!
    Also see my web page: view this site

    ReplyDelete
  4. I like it when folks get together and share thoughts.
    Great website, keep it up!
    Here is my webpage ... how can I get taller

    ReplyDelete
  5. Greetings! I know this is kinda off topic but I was
    wondering which blog platform are you using for this website?
    I'm getting sick and tired of Wordpress because I've had issues with hackers and I'm looking at alternatives for another platform. I would be awesome if you could point me in the direction of a good platform.

    Also visit my blog post :: internet dating websites

    ReplyDelete
  6. Hey! This is my first visit to your blog! We
    are a team of volunteers and starting a new project in a community in the same
    niche. Your blog provided us beneficial information to
    work on. You have done a marvellous job!

    my homepage: free dating and chat

    ReplyDelete
  7. Hello There. I found your weblog the usage of msn.

    This is a very neatly written article. I�ll make sure to bookmark it and return to learn more
    of your helpful information. Thank you for the post.

    I�ll definitely comeback.

    my homepage - online datine

    ReplyDelete
  8. Thanks for the points you have shared here.
    Another thing I would like to talk about is that computer memory requirements
    generally increase along with other breakthroughs in the technological know-how.
    For instance, when new generations of cpus are introduced to the market, there is usually a matching increase in the shape eferences of
    both the pc memory and hard drive space. This is because the
    software program operated by way of these processors will inevitably rise in power to make new engineering.


    Here is my website: fuckbook

    ReplyDelete
  9. I just could not leave your website prior to suggesting that I really loved the usual info an individual supply
    on your visitors? Is gonna be back ceaselessly in order to inspect new posts

    Feel free to surf to my website; free adult personals

    ReplyDelete
  10. Hi,

    How to write a xpath ,that ignores the case for example below is the xpath in selenium webdriver


    //div[@id='model-showroom-current-year-container'][div[div[div[div]]]]/div/div/descendant::div[@class='model-name' and contains(text(),' C-MAX')]

    ReplyDelete
    Replies
    1. The xpath should ignore the case of 'C-MAX',Kindly let me know on this Niraj

      Delete
  11. It is perfect time to make a few plans for the future and it is time to be happy.
    I've learn this put up and if I could I desire to counsel you some attention-grabbing things or suggestions. Maybe you could write next articles relating to this article. I desire to read more things approximately it!

    my blog - party hardcore

    ReplyDelete
  12. Greate pieces. Keep posting such kind of information on your page.
    Im really impressed by your site.
    Hey there, You've performed an incredible job. I'll certainly digg it
    and individually recommend to my friends. I'm sure they'll be benefited
    from this web site.

    Here is my page :: http://sexvideovoyeur.com/

    ReplyDelete
  13. First off I would like to say great blog! I had a quick question which I'd like to ask if you do not mind. I was interested to find out how you center yourself and clear your mind before writing. I have had trouble clearing my thoughts in getting my thoughts out there. I truly do enjoy writing but it just seems like the first 10 to 15 minutes are usually lost just trying to figure out how to begin. Any ideas or hints? Many thanks!

    Stop by my web page; xvideo

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Its Brilliant knowledge For Over-automation.Over-automation is so good.

    ReplyDelete
  17. Your information about automation is really interesting. Also I want to know the latest new techniques which are implemented in automation. Please update it in your website.

    ReplyDelete
  18. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium

    ReplyDelete
  19. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium.
    Selenium

    ReplyDelete
  20. It was very nice blog to learn about SAP HR.Thanks for sharing new things.SAP HR

    ReplyDelete
  21. Thanks for sharing great information in your blog. Got to learn new things from your Blog .
    java training in chennai

    ReplyDelete
  22. It was very nice blog to learn about Selenium.Thanks for sharing new things.selenium training in chennai

    ReplyDelete
  23. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    selenium training in chennai

    ReplyDelete
  24. This is extremely great information for these blog!! And Very good work. It is very interesting to learn from to easy understood.


    software testing course online

    ReplyDelete
  25. hi can any one plz help me to find this dynamic xpath

    html/body/div[5]/div[2]/div[3]/div[2]/div/div[2]/div/div[4]/div/div[1]/div/div/div[2]/div[1]/div/div/fieldset/div/div[1]/div/div[1]/div/div/a

    ReplyDelete
  26. Thanks For Clearing All My Doubts Through Your Website Post.You Cleared All My Doubts.Coming To Our Self We Provide Food Service Parts Through Out US At Very Affordable Prices And Also We Offer Same Day Shipping In US.We Offer Only Genuine Products. Really Thanks For Sharing.

    ReplyDelete
  27. This Blog is very helpful and useful,came to know that i should be strong in my basics and this blog helps me to improve it,Primary Care Chicago Services Provided by Us.Thanks For Posting.I Am refereed by my friend to this blog and i also want to refer my other friends to this blog.

    ReplyDelete
  28. Thank you Admin!
    Real time project center provides IEEE projects in chennai

    ReplyDelete
  29. I like your writing style, it was very clear to understanding the concept well; I hope you ll keep your blog as updated.
    Regards,

    B.com Application Projects in Chennai | Best Project Centers in Chennai.

    ReplyDelete
  30. I Just Love to read Your Articles Because they are very easy to understand USMLE Thank you.

    ReplyDelete
  31. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things.

    IEEE NS3 Projects in Chennai | IEEE Electronics Projects in Chennai.

    ReplyDelete
  32. Thanks for such important information.keep up the good work.Ethical Hacking training is based on current industry standards that helps attendees to secure placements in their dream jobs at MNCs. Indian Cyber Army Provides Best Ethical Hacking Training in India.Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses

    ReplyDelete
  33. Really Thanks For Posting Such an Useful and informative article I gathered some needful information from your blog digital transformation consulting

    ReplyDelete
  34. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer
    fire and safety course in chennai

    ReplyDelete