December 8, 2010

Select,identify selected and print values in dropdown

Here is the post which will explain you 

How to select a value from drop down
Identify the selected value in drop down.
Display the values in drop down
Verifying Element is Present or not here i used xpath to find that


package test;


import com.thoughtworks.selenium.*;


import org.openqa.selenium.server.*;
import org.testng.annotations.*;




public class Dropdownselectvalue {
public Selenium selenium;
public SeleniumServer seleniumserver;


  @BeforeClass
  public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();
}


@Test
public void testDropdownselectvalue()throws Exception {

selenium.open("http://www.google.com");
selenium.windowMaximize();
selenium.click("link=Advanced Search");
selenium.waitForPageToLoad("50000");
// Print all the available options from the results dropdown in the
String[] options = selenium.getSelectOptions("name=num");
// The above command returns a array of strings(options)
    for (int i = 0; i < options.length; i++) {
System.out.println("Option: " + i + " is " + options[i]);
}
//select value from dropdown
    selenium.select("num", "label=30 results");
    //Print the selected value from dropdown
String s=selenium.getSelectedValue("name=num");
System.out.println("selected value is "+s);

//Verifying Element is Present or not here i used xpath to find that if(selenium.isElementPresent("//select[@name='num']/option[contains(text(),'50 results')]")) { System.out.println("ys"); }


}
   
 @AfterClass
 public void tearDown()throws Exception {
selenium.stop();
seleniumserver.stop();
 
 }
 }


.

54 comments:

  1. Hello, after reading this amazing piece of writing i am as well cheerful to share my experience here with
    friends.
    Feel free to visit my web site :: free iphone

    ReplyDelete
  2. Hey! I could have sworn I've been to this site before but after browsing through some of the post I realized it's
    new to me. Nonetheless, I'm definitely happy I found it and I'll be book-marking and checking back frequently!
    Also visit my web-site ; amphora tobacco

    ReplyDelete
  3. Great beat ! I would like to apprentice at the same time as you amend
    your website, how could i subscribe for a weblog site? The account aided
    me a appropriate deal. I had been tiny bit familiar of this your broadcast
    offered brilliant transparent idea
    Review my web-site : van nelle tobacco

    ReplyDelete
  4. Have you ever thought about creating an ebook or guest authoring on other sites?
    I have a blog centered on the same ideas you discuss and would really like to have you share some stories/information.
    I know my readers would appreciate your work.
    If you are even remotely interested, feel free to send me an email.
    My page :: amber leaf

    ReplyDelete
  5. Write more, thats all I have to say. Literally, it seems as
    though you relied on the video to make your point.
    You clearly know what youre talking about, why throw away your intelligence on just posting videos
    to your weblog when you could be giving us something enlightening to read?
    Also visit my website ; old holborn

    ReplyDelete
  6. What a data of un-ambiguity and preserveness of valuable familiarity on the topic of unexpected feelings.
    Feel free to surf my web page :: Feriebolig Bodrum

    ReplyDelete
  7. You really make it seem so easy with your presentation but I
    find this topic to be really something that I think I would never understand.
    It seems too complicated and extremely broad for me.
    I am looking forward for your next post, I will try to get the hang of it!
    Also visit my website ; asuntoturkista.net

    ReplyDelete
  8. Stunning story there. What happened after? Good luck!
    Also visit my site - http://asuntoturkista.net/kiinteistot-antalya

    ReplyDelete
  9. My programmer is trying to persuade me to move to .

    net from PHP. I have always disliked the idea because of the costs.
    But he's tryiong none the less. I've been using WordPress
    on various websites for about a year and am anxious about switching to
    another platform. I have heard fantastic things about blogengine.
    net. Is there a way I can import all my wordpress posts into
    it? Any help would be greatly appreciated!
    My weblog :: immobilienalanya.net

    ReplyDelete
  10. What a stuff of un-ambiguity and preserveness of valuable familiarity concerning unexpected emotions.
    Here is my webpage - Wohnungen kaufen Antalya

    ReplyDelete
  11. May I simply just say what a comfort to uncover an individual who actually knows
    what they're discussing over the internet. You actually realize how to bring an issue to light and make it important. A lot more people need to check this out and understand this side of the story. I was surprised you aren't more
    popular since you most certainly have the gift.
    Here is my weblog ... whitening cream

    ReplyDelete
  12. Hello, I think your web site may be having
    browser compatibility problems. Whenever I look at your
    web site in Safari, it looks fine but when opening in IE, it has some
    overlapping issues. I simply wanted to provide
    you with a quick heads up! Apart from that, fantastic blog!
    Here is my webpage how to lose man boobs

    ReplyDelete
  13. fantastic publish, very informative. I wonder why the opposite experts
    of this sector do not realize this. You should proceed your writing.
    I am confident, you've a huge readers' base already!
    Feel free to visit my web-site - eliminate acne

    ReplyDelete
  14. Spot on with this write-up, I really feel this site needs far
    more attention. I'll probably be back again to read through more, thanks for the advice!
    Look into my web blog ... how to get rid of acne in one day

    ReplyDelete
  15. Hello! Someone in my Myspace group shared this site with us so
    I came to look it over. I'm definitely loving the information. I'm bookmarking and will
    be tweeting this to my followers! Exceptional blog and excellent style and
    design.
    My web blog in the Middle of the day

    ReplyDelete
  16. Amazing! Its genuinely awesome article, I have
    got much clear idea regarding from this article.
    My website - how to get rid of man boobs

    ReplyDelete
  17. Nice post. I learn something new and challenging on websites I stumbleupon on a
    daily basis. It will always be helpful to read through articles from other writers and use something from their web
    sites.
    My web blog ; http://Www.hazeldesign.co.uk/devblog/groups/things-To-know-about-tattoo-removing

    ReplyDelete
  18. Howdy just wanted to give you a quick heads up. The words
    in your post seem to be running off the screen in Chrome.
    I'm not sure if this is a format issue or something to do with internet browser compatibility but I figured I'd
    post to let you know. The layout look great though! Hope you get the issue fixed soon.
    Many thanks
    Also see my web page: diablo 3 guide

    ReplyDelete
  19. magnificent issues altogether, you just received a emblem new reader.
    What may you recommend about your post that you simply made some days in the past?
    Any certain?
    Feel free to surf my weblog :: skin whitening products

    ReplyDelete
  20. WOW just what I was looking for. Came here by searching for best ways to make money from home
    Here is my web site : recycle computers Make Money

    ReplyDelete
  21. Pretty! This has been a really wonderful post.
    Many thanks for providing this information.
    Also visit my website tattoo removal cost

    ReplyDelete
  22. Thanks for one's marvelous posting! I quite enjoyed reading it, you will be a great author. I will be sure to bookmark your blog and will eventually come back someday. I want to encourage you to continue your great writing, have a nice morning!
    Here is my website - earn money from home

    ReplyDelete
  23. Asking questions are in fact good thing if you are not understanding
    something fully, but this article provides good understanding even.
    My blog post insider.supermhon.com

    ReplyDelete
  24. Great goods from you, man. I've remember your stuff previous to and you're just too magnificent.
    I actually like what you have got right here, really like what you are saying and the best way through which you are
    saying it. You're making it enjoyable and you still take care of to stay it wise. I can not wait to learn much more from you. That is actually a tremendous site.
    Visit my web-site ... how to get rid of acne spots

    ReplyDelete
  25. I realize that there is not a ton of variety in this list, since
    Rogue and i - Net - Hack are essentially the same and Sorcerer #1 and #2 are more
    overtly the same. Resident Evil 2 is the undisputed king daddy in the world of early survival horror.
    A Twitter app for Zune has been created and is now available
    for download through Microsoft's Marketplace.

    My webpage youtube downloader online

    ReplyDelete
  26. Thanks , I've recently been looking for information approximately this topic for a long time and yours is the greatest I have found out till now. However, what about the conclusion? Are you positive about the source?

    Feel free to visit my web-site; videos von youtube downloaden
    my site > visit the following page

    ReplyDelete
  27. I've been browsing on-line more than 3 hours lately, yet I by no means discovered any interesting article like yours. It is lovely price sufficient for me. Personally, if all site owners and bloggers made excellent content as you probably did, the web might be a lot more helpful than ever before.

    Also visit my web blog ... key kaufenFar Cry 3 key
    My web site > Crysis 3 Game Key

    ReplyDelete
  28. Good post. I certainly love this website.
    Keep writing!

    Stop by my blog: youtube converter

    ReplyDelete
  29. If you desire to take a great deal from this piece of writing then you have to apply such methods to your won weblog.


    My website :: online radio
    my webpage: pdexreqser.livejournal.com

    ReplyDelete
  30. Yes! Finally something about radio flyer trike rŠµview.



    my page; russische Musik
    Also see my site > Rudimentary Aspects For internet Uncovered

    ReplyDelete
  31. Hello this is somewhat of off topic but I was wanting to
    know if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I'm starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

    My webpage - forex platforms
    My site: Forex Trade

    ReplyDelete
  32. Tomb Raider, Mega Moolah, Mermaid's Millions, and Blackjack are some of the new Android game apps that have been released from Microgaming's partner, Spin 3.
    One way to test yourself is to deal yourself hand
    after hand in front of a mirror and watch yourself as you react to the cards.

    The full version has no ads and offers goal alerts for the leagues and teams of your choice.


    My web page :: youtube converter
    my web site > videos von youtube downloaden

    ReplyDelete
  33. Hello, Neat post. There's an issue together with your web site in internet explorer, could check this? IE still is the marketplace chief and a good section of other people will omit your wonderful writing due to this problem.

    My web-site :: How to get free money Fast

    ReplyDelete
  34. Marvelous, what a web site it is! This web site presents valuable
    data to us, keep it up.

    Also visit my webpage: make free Money now
    Also see my web page - get free money online now

    ReplyDelete
  35. Amazing! Its truly awesome piece of writing, I have got much clear idea concerning from this paragraph.


    Also visit my website - get money now for free

    ReplyDelete
  36. Yet another first person shooter game this time around, but the first Far
    Cry was quite good. So even at young ages and relatively low levels of the sport,
    goalies will have their helmets designed with various colors, prints and patterns, shapes or designs, and more.
    ' The Rooneys are a great family who turned a football franchise into a traveling nation full of fans across the United States. With an average annual fee of 10,000 pounds, representing between 25% - 36% of professional incomes this has risen assiduously by 41% in the last five years. Do you really want to see the hard-earned money of you and your spouse end up in the bank account of a lawyer who doesn't even know you.
    Originally established as a sanctuary for the Nilgiri
    Tahr, the 'The Eravikulam National Park' has now turned into a highly popular tourist spot.
    They will check into a purpose built sports complex 8 miles
    from the venue of their first match in Rustenburg.

    Most visitors on a trip to Munnar invariably end up at the Tata Tea Museum and
    gain some delightful insights into the process of
    tea making. Today, the company has over 1. I died numerous times because of the stupid reload system.


    my site: catena.projectroom.jp

    ReplyDelete
  37. Hi there, I enjoy reading through your article post. I like to
    write a little comment to support you.

    My web-site: i need money today for free
    Also see my web page :: make money taking surveys

    ReplyDelete
  38. Tomb Raider, Mega Moolah, Mermaid's Millions, and Blackjack are some of the new Android game apps that have been released from Microgaming's partner, Spin 3.
    WIFI:Als Verbindungsmoglichkeiten ins Internet stehen Ihnen WIFI wireless
    lan zu Verfugung. In fact an ideal online casino will make the entire gaming
    experience a pleasurable and a real experience to the gamer.


    Here is my website ... onlineradio

    ReplyDelete
  39. Hold down an app for a second, and start turning off
    all the apps that you aren't using by pressing the "minus" button. An alternate electrical power source reduces the probability that the access technique will turn out to be inoperable via strength reduction and aid conserve battery lifestyle. Pingbatterys battery administration program (BMS) might have the line of Light emitting diodes visible.

    Here is my web blog; internetradio - 8tracks.com

    ReplyDelete
  40. Your way of telling all in this post is genuinely good, all can without difficulty understand it, Thanks a
    lot.

    my website: make money online free

    ReplyDelete
  41. It's really very complicated in this busy life to listen news on Television, thus I only use the web for that reason, and take the latest information.

    Here is my web blog :: how to make easy money

    ReplyDelete
  42. The fishfinder approximates where the fish are by measuring the
    amount of time between when the beam was sent out and when it
    registered the hit. Never dawned on me that they might want to try
    it, so I was surprised one day in the late-eighties when my son called and said they wanted to go fishing.

    All the equipment is included in your deep sea fishing charter Cancun and the boat is so nice you will want to take advantage
    of the luxury fishing afforded from the Querida del Mar.


    Here is my web page ... http://www.fisantekraal.co.za

    ReplyDelete
  43. Una Musica Brutal, by Gotan Project: from Buddha Bar IV.
    I know a lot more music now than before and have changed my tastes.

    Be comfortable in its open-air concept restaurant, where
    you might even sit in a table and look up to see stars in a clear night sky.


    Also visit my homepage; chillout

    ReplyDelete
  44. Try simple games and check how your internet connection is and then move on play more games.

    All spaceship game leveling systems are designed slightly differently, but there
    are some general concepts that apply to
    all games in this genre. But what happens when a player runs out of race tokens.



    Here is my weblog :: Visit posters website

    ReplyDelete
  45. Hurrah! After all I got a blog from where
    I be able to really obtain helpful facts regarding my study and knowledge.



    My web site ... Forgot Password

    ReplyDelete
  46. This info is invaluable. Where can I find out more?


    Look at my web blog; Make Money With Virtual Currency

    ReplyDelete
  47. Hi, its pleasant paragraph regarding media print, we all be familiar with media is a enormous source of facts.



    Feel free to visit my homepage - Sexy Pictures

    ReplyDelete
  48. What's up, I log on to your blogs regularly. Your writing style is awesome, keep doing what you're doing!


    Here is my blog castleville

    ReplyDelete
  49. Thanks very interesting blog!

    Review my blog :: increase Youtube Views

    ReplyDelete
  50. I cover my freshly sharpened hook with paste and coat the hair and bait in paste.
    Spinning - Trout are aggressive and definitely will
    strike and eat smaller fish. If the fish are not hitting
    on your main crappie jigs you may need to switch to live bait or a
    combination of live and artificial baits.

    my weblog http://alfacom-dubai.com/celiaolea

    ReplyDelete
  51. clients, Rachel, who got back together with her ex.
    All spaceship game leveling systems are designed slightly differently, but there are some general concepts that
    apply to all games in this genre. If you want to be able to hit the ball further and harder, you should keep in
    mind to keep your grip on the bat loose, your swing should begin with your legs and hips,
    and finally, you must always follow your bat through.

    Look into my website Homepage ()

    ReplyDelete
  52. The developers are saying that Defiance is a pixel perfect
    shooter, so if you aim at your target's head it WILL be a headshot instead of the invisible dice rolling a 5 and telling you that you somehow missed. The only downside of it in a lot of people's eyes is the fact that there
    is no multiplayer content. Are you a Kansas
    City Chiefs or Pittsburgh Steelers fan.

    Stop by my homepage - little shop of horrors ()

    ReplyDelete
  53. Imagine existing capable to place a box in the former parts of the dead
    body is a big fault. Start Out another repeating at a
    feeling fat after losing system of weights? Already
    consume instinctive, unrefined intellectual nourishments as much
    as possible. Don't Fuddle Your CaloriesNews heartbeat; Fuddleing proportions to feed musculus and sunburn up undesirable fat in the selfsame time. Body builders should realize that sit ups or scraunch workout are not plenty to melt the blast the fat on your tummy.

    Feel free to visit my web site ... review of the truth about abs :: ::

    ReplyDelete
  54. You might need heavier line and tackle to account for powerful river flows.

    Pay close attention to the mayflies, midges, and stoneflies in the area and try to match your flies to the size and type fish are biting on.

    All the equipment is included in your deep sea fishing charter Cancun and the boat is so nice you will want to take advantage of
    the luxury fishing afforded from the Querida del Mar.



    My web site - http://www.beaba.info/modules.php?name=Your_Account&op=userinfo&username=BennieDie ()

    ReplyDelete