Friday, August 26, 2016

Bootstrap Dropdown Example for Selenium

Dropdowns

The .dropdown class is used to indicate a dropdown menu.

Use the .dropdown-menu class to actually build the dropdown menu.







51 comments:

  1. if Html option is disable then how to verify in selenium that option is disabled

    ReplyDelete
  2. Sir from this below code i'm not able to print the options of dropdown

    public class DropDownOption
    {
    public WebDriver driver=new FirefoxDriver();

    public void openURL()
    {
    System.setProperty("webdriver.firefox.marionette", "D:\\Mahesh\\Library\\geckodriver-v0.14.0-win64\\geckodriver.exe");
    driver.get("http://spicejet.com");
    driver.manage().window().maximize();

    driver.findElement(By.xpath("//input[@id='ctl00_mainContent_ddl_originStation1_CTXT']")).click();

    List dropdown=driver.findElements(By.xpath("//div[@id='glsctl00_mainContent_ddl_originStation1_CTNR']//ul//li//a"));

    for(int i=0;i<dropdown.size();i++)
    {
    WebElement drp=dropdown.get(i);

    String innerhtml=drp.getAttribute("innerhtml");

    System.out.println("city from -- "+innerhtml);
    }
    }
    public static void main(String[] args)
    {
    DropDownOption obj=new DropDownOption();
    obj.openURL();

    }

    }

    ReplyDelete
    Replies
    1. Hi Mahesh Sheelvant

      code is correct please update,

      "innerhtml" into "innerHTML"

      String innerhtml=drp.getAttribute("innerHTML");

      Delete
  3. Thanks for Sharing this blog, it is very helpful to us. A good information to learners and each and every topic is easy to understand ...... Selenium Online Training

    ReplyDelete
  4. Excellent ! I am truly impressed that there is so much about this subject that has been revealed and you did it so nicely.
    Selenium Training in Chennai

    ReplyDelete
  5. Very nice video on bootstrap dropdown. On Ie browser, bootstrap dropdown is working using xpath but it diaappers very fast.

    How to give more time on bootstrap dropdown once it appears?

    ReplyDelete
  6. hi, it was also help ful for people working in python. I create code for python3.x and it worked 100%.
    ####Python Code Start
    from selenium import webdriver
    driver = webdriver.Firefox()
    url="http://seleniumpractise.blogspot.in/2016/08/bootstrap-dropdown-example-for-selenium.html"
    driver.get(url)
    driver.find_element_by_xpath('//*[@id="menu1"]').click()
    driver.implicitly_wait(10)
    dd_menu = driver.find_elements_by_xpath('//ul[@class="dropdown-menu"]//li/a')

    for Element in dd_menu:
    ElementValue= Element.get_attribute("innerHTML")
    print ("Value for DropDown is ------->" + ElementValue )
    if ElementValue.find('JavaScript') != -1:
    #print (ElementValue)
    Element.click()
    #### Python Code End

    ReplyDelete
  7. Thank you.Well it was nice post and very helpful information on selenium Online course Hyderabad

    ReplyDelete
  8. It Great Selinium Blogger. its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    selenium Online Training Hyderabad

    ReplyDelete
  9. This is one awesome blog article. Much thanks again. selenium Online Training Bangalore

    ReplyDelete
  10. Thanks for the informative article. This is one of the best resources I have found in quite some time. Once Again Thanks for Sharing this Valuable Information i like this i Can Share this with My Friend Circle.
    Selenium Training in Noida
    Selenium Course in Noida

    ReplyDelete
  11. I really enjoy the blog.Much thanks again. Really Great selenium Online Training Bangalore

    ReplyDelete
  12. Selenium Training is one of the most powerful open source automation tool for web application testing (even we can say acceptance testing for web application) which lets you automate operations like — type, click, selection from a drop down etc of a web page. Primarily developed in Java Script and browser technologies such as DHTML and Frames and hence supports all the major browsers on all the platforms.

    ReplyDelete
  13. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. This paragraph gives clear idea for the new viewers of blogging, Thanks you. You’re doing a great job Man, Keep it up.
    selenium Training in Delhi

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

    ReplyDelete
  15. Thanks for Sharing This Valuable Information with Us.
    Selenium Training in Gurgaon

    ReplyDelete
  16. We at COEPD provides the best web Designing course in Hyderabad. Your search to learn web designing technology ends here at COEPD. Here, we are an established training institute who have trained more than 10,000 participants in all streams. We will help you to convert your passion to learn into an enriched learning process. At COEPD, we provide finest web designing technology covering Photoshop, HTML, CSS, HTML5, CSS3, JavaScript, Boot Strap, and JQuery. We train participants to be solution providers and creative engineers.

    http://www.coepd.com/WebDesigning.html

    ReplyDelete
  17. This is one of the best resources I have found in quite some time. Once Again Thanks for Sharing this Valuable Information.
    Selenium Training in Hyderabad

    ReplyDelete
  18. I have read your blog its very attractive and impressive. I like your blog selenium Online Training

    ReplyDelete
  19. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    java training in chennai

    java training in bangalore

    java online training

    java training in pune

    ReplyDelete
  20. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Hadoop Training in Chennai
    Hadoop Training in Bangalore
    Big data training in tambaram
    Big data training in Sholinganallur
    Big data training in annanagar

    ReplyDelete
  21. I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favourites blog site list and will be checking back soon.
    java training in chennai | java training in bangalore

    java online training | java training in pune

    java training in chennai | java training in bangalore

    java training in tambaram | java training in velachery

    ReplyDelete
  22. Good blog and I never get bored while reading your article
    because, they are becomes a more and more interesting from the starting lines until the end.
    Selenium online training in Hyderabad

    ReplyDelete
  23. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune
    Data science training in kalyan nagar
    Data Science with Python training in chenni

    ReplyDelete
  24. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Devops Training in Chennai

    Devops Training in Bangalore

    ReplyDelete

  25. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.

    rpa training in Chennai

    rpa training in anna nagar | rpa training in marathahalli

    rpa training in btm | rpa training in kalyan nagar

    rpa training in electronic city | rpa training in chennai

    rpa online training | selenium training in training

    ReplyDelete
  26. I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.
    Python training in marathahalli
    Python training in pune
    AWS Training in chennai

    ReplyDelete
  27. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    java training in omr | oracle training in chennai

    java training in annanagar | java training in chennai

    ReplyDelete
  28. very informative blog and useful article thank you for sharing with us , keep posting Big Data Hadoop Online Training Hyderabad

    ReplyDelete
  29. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Python training in usa
    Python training in marathahalli
    Python training in pune
    Python training in usa
    Python training in marathahalli
    Python training in pune

    ReplyDelete
  30. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    DevOps online Training
    DevOps Training in USA

    ReplyDelete
  31. This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here 
    python online training
    python training in OMR
    python training in tambaram

    ReplyDelete
  32. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    Devops Training in Chennai
    Devops training in sholinganallur

    ReplyDelete
  33. Just stumbled across your blog and was instantly amazed with all the useful information that is on it. Great post, just what i was looking for and i am looking forward to reading your other posts soon!
    Just stumbled across your blog and was instantly amazed with all the useful information that is on it. Great post, just what i was looking for and i am looking forward to reading your other posts soon!

    angularjs Training in chennai
    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    ReplyDelete

  34. Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    Amazon Web Services Training in Pune | Best AWS Training in Pune

    AWS Online Training | Online AWS Certification Course - Gangboard

    ReplyDelete
  35. The site was so nice, I found out about a lot of great things. I like the way you make your blog posts. Keep up the good work and may you gain success in the long run.
    Data Science course in rajaji nagar | Data Science with Python course in chenni
    Data Science course in electronic city | Data Science course in USA
    Data science course in pune | Data science course in kalyan nagar

    ReplyDelete
  36. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
    AWS Training in Chennai |Best Amazon Web Services Training in Chennai
    AWS Training in Rajaji Nagar | Amazon Web Services Training in Rajaji Nagar

    Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM

    ReplyDelete
  37. 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, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    Best Selenium Training in Chennai | Selenium Training Institute in Chennai | Besant Technologies

    Selenium Training in Bangalore | Best Selenium Training in Bangalore

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    ReplyDelete