How to handle Bootstrap DropDown in Selenium - Session - 19

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024
  • How to handle Bootstrap DropDown in Selenium :
    • How to handle different styles of bootstrap down
    • Click on the given dropdown
    • Get all the tags while are available under "li" tag
    • Get the text of each "li//a" OR "div//a"
    • Match the text and click on it
    ===================================================
    Please subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    Channel URL:
    www.youtube.co...
    =======================================================
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion. Plz join via this link:
    t.me/joinchat/...
    ~-~~-~~~-~~-~
    Follow my Site/Blog: www.naveenautom...
    ========================================================
    Please watch: "Selenium & Automation Interview Preparation - By Naveen AutomationLabs"
    • Selenium & Automation ...
    ~-~~-~~~-~~-~ Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    www.youtube.co...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/...
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom... ➡️Get Our Courses✔️
    📗 Get My Paid Courses at
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom...
    -------------------------------
    ✔️SOCIAL NETWORKS
    Facebook: / naveenqtpexpert
    Twitter: / naveenkhunteta
    Blog: www.naveenautom...
    --------------------------------
    Support My Channel✔️Or Buy Me A Coffee
    Paypal: paypal.me/nave...
    Google Pay: naveenanimation20@gmail.com
    --------------------------------
    ✔️Thanks for watching!
    देखने के लिए धन्यवाद
    Благодаря за гледането
    感谢您观看
    Merci d'avoir regardé
    Grazie per la visione
    Gracias por ver
    شكرا للمشاهدة

ความคิดเห็น • 57

  • @krishnakrishna934
    @krishnakrishna934 4 ปีที่แล้ว +1

    Thank you so much Naveen i really cant express happiness ..i am just asked every person but i dont get answer like you from any1 ...Really this concept is very very useful..bcoz 80% of people dnt know how to do bcoz we always depend upon select class..

  • @omkarpotdar2763
    @omkarpotdar2763 2 ปีที่แล้ว +1

    Thank you very much Naveen to explain this topic in a smart and easy way. Keep it up Naveen😊

  • @madhusudandevaraju1207
    @madhusudandevaraju1207 5 ปีที่แล้ว +5

    For the already selected options, we can't use isSelected() method. Because this method always returns false. So we have to use the li-class which changes the class name to "active" when the checkbox is selected. So we can select all the checkboxes without unselecting the already selected ones by using below logic.
    for (int i = 0; i < bsOptions.size(); i++) {
    if ((bsOptions.get(i).getAttribute("class").equalsIgnoreCase("active"))) {
    System.out.println(bsOptions.get(i).getText());
    Thread.sleep(1000);
    } else
    bsOptions.get(i).click();
    }

    • @umangsharma7447
      @umangsharma7447 4 ปีที่แล้ว

      awesome bro !

    • @umangsharma7447
      @umangsharma7447 4 ปีที่แล้ว

      As mentioned by madhu : - we have to get the list of elements as below ( i.e. till the li class)
      List elements = driver.findElements(By.xpath("//ul[contains(@class,'multiselect')]//li"));
      for (WebElement ele : elements) {
      System.out.println(ele.getAttribute("class").equalsIgnoreCase("active"));
      if(ele.getAttribute("class").equalsIgnoreCase("active"))
      {
      System.out.println(ele.getText());
      }
      else {
      ele.click();
      }
      }

    • @ramakrishnants7826
      @ramakrishnants7826 4 ปีที่แล้ว

      Hello Sir, i was looking for a solution for this issue, thanks a lot for the comment

  • @divyarani9754
    @divyarani9754 9 หลายเดือนก่อน

    Very nice explanation..which is in detail..i just subscribed your channel though its old its very useful now..

  • @surejmathewc8751
    @surejmathewc8751 4 ปีที่แล้ว

    Hi Naveen, videos which your posting is very helpful and am referring your video to practice and expertise automation....really helpful

  • @BunyiSordera
    @BunyiSordera 2 ปีที่แล้ว +1

    You are a damn hero!

  • @amitbhardwaj7824
    @amitbhardwaj7824 4 ปีที่แล้ว

    nice lecture plz keep uploading

  • @theevenbit2754
    @theevenbit2754 2 ปีที่แล้ว

    💌 excellent video

  • @hanuman411
    @hanuman411 4 ปีที่แล้ว +2

    Thank you naveen. it helped and worked great!

  • @bsrinivas165
    @bsrinivas165 6 ปีที่แล้ว +1

    Awesome explanation👌👌... Thank you 💐💐

  • @v2factsandupdates327
    @v2factsandupdates327 2 ปีที่แล้ว

    Thanks sir

  • @Anaris13
    @Anaris13 4 ปีที่แล้ว +1

    Great Thanks Naveen, this video helped me a lot, I paid attention you always sharing solution for most tricky cases. Again Thanks a lot .

  • @meetnakrani4381
    @meetnakrani4381 2 ปีที่แล้ว +1

    Use this method for calendar. It work

  • @julyuser1030
    @julyuser1030 4 ปีที่แล้ว

    Good

  • @jyotiprokashmondal1518
    @jyotiprokashmondal1518 3 ปีที่แล้ว

    Nice tutorial. Please make another tutorial to handle angular js dropdown.

  • @sridevireddy1371
    @sridevireddy1371 6 ปีที่แล้ว +2

    Thanks a ton...

  • @amitgaigawali4606
    @amitgaigawali4606 3 ปีที่แล้ว +1

    @Navin_AutomationLabs thanks, but i have one diffrent scenario. that is dropdown within dropdown. i.e. main tap is 'Financial' then it has three dropdown menu, then that each have other 4 dropdown. how can it be handle

  • @Julyanajs
    @Julyanajs 6 ปีที่แล้ว

    thanks for share, this video was very useful!

  • @22Shoyab
    @22Shoyab 5 ปีที่แล้ว +1

    Hi naveen can you tell me how to validate which options from. Dropdown are highlighted by default (bootstrap dropdown)

  • @rajeshchowdary1615
    @rajeshchowdary1615 5 ปีที่แล้ว

    Hi, Naveen your videos are very good,
    in this video I've doubt i.e once I clicked on the dropdown button I got 14 options as you said. And I want to select Angular so here I can use
    Dynamic XPath right i.e selecting the checkbox based on Angular element na .. here I'll inspect the independent element angular and dependent element checkbox... using XPath as ....... //label[text()=' Angular']/../../..//input[@value='Angular']

  • @varnaramkorepu7450
    @varnaramkorepu7450 2 ปีที่แล้ว

    hi sir am following your channel for my preparation it is excellent and i got so much from your channel...can u plz guide me is this info is enough for 3 yrs exp candidates where i wanted to try my job search on 3 yrs experience.. prevoiusly i wrked in non-it sector will u guide me i hope ...👍👍👍

  • @rupjitdas8509
    @rupjitdas8509 4 ปีที่แล้ว

    Hi @naveen, I have a doubt why cannot we directly do the click operation rather than getting all the webelements of the bootstrap drop down and adding the for loop to find the text and then click, I understand that in dynamic web table we need to do this but why it is needed here also

  • @puneetpawar8494
    @puneetpawar8494 ปีที่แล้ว

    Bro can you tell me how can I select random value on such a drop down

  • @TheNishi42
    @TheNishi42 6 ปีที่แล้ว

    Thank you !!

  • @poojapadmawar8977
    @poojapadmawar8977 2 ปีที่แล้ว

    Hi Naveen.. What if we have select tag under the div tag. Its not working if I use select class over there. Can I use your method for bootstrap??

  • @debayankabiraj
    @debayankabiraj 2 ปีที่แล้ว

    Hi Navin, Thank you for the Bootstrap dropdown. It helped, but i have a dropdown which scrolls down, and using your method i was only able to select visible items in the dropdown, it is not scrolling down to find an element, used javascript query to scrollTo view, but did not scroll, can you help with this?

  • @dileepnaidu9610
    @dileepnaidu9610 4 ปีที่แล้ว

    Hi Naveen
    I have same scenario where bootstrap dropdown having only "div" than nothing else. i have inspected on dropdown but found only div-class so unable to select dropdown items
    Could you please tell me how to handle such kind of dropdowns having only div class

  • @attitudelove4517
    @attitudelove4517 2 ปีที่แล้ว

    Hi Naveen, How to automate the Material UI dropdown?

  • @utlavamsi6976
    @utlavamsi6976 6 ปีที่แล้ว

    Hiii guy's anyone recently faced interview for 3+experience guys. Which type questions you have faced at the time of interview pls pls guy's send me... Useful for everyone

  • @vijaybahadur5755
    @vijaybahadur5755 5 ปีที่แล้ว +1

    That was really helpful....
    Can you please make one tutorial is video for Jmeter 5.0 also...?
    Please because you have got awesome ability to explain.. I love ❤ the way you elaborate something.
    Thanks in advance.

  • @pushpapacharya
    @pushpapacharya 5 ปีที่แล้ว +3

    Can't I write //ul[contains(@class,'multiselect-container')]//li//a//label[contains(text(),'Angular')] directly to select the element and perform click operation instead getting list of label then selecting that element and performing click operation?

    • @edwindeepak6234
      @edwindeepak6234 5 ปีที่แล้ว

      I also have the same doubt. Have you checked the xpath?

    • @bipinmnair007
      @bipinmnair007 5 ปีที่แล้ว

      Yes you can use the same as well

    • @Anaris13
      @Anaris13 4 ปีที่แล้ว

      If you want directly to click You can use //label[contains(text(),'Angular')] , but if your requirement is to validate all elements is thart dropDown you need to follow as Naveen did in video and store elements in List.

  • @tejastoley6714
    @tejastoley6714 4 ปีที่แล้ว

    I use this customized xpath, List list = driver.findElements(By.xpath("//div[@class='dropdown show']//child::div"));
    System.out.println(list.size());
    for(int i=0; i

  • @akulabhaskar3797
    @akulabhaskar3797 6 ปีที่แล้ว +1

    Hello Naveen Can u share the link which u used

  • @shaiksameena7603
    @shaiksameena7603 6 ปีที่แล้ว

    Could you please how to edit drop-down values

  • @thippeswamyss5202
    @thippeswamyss5202 4 ปีที่แล้ว

    I am facing some issue in selecting value in bootstrap drop down , i cant even see the drop down values in HTML code . Please help me with this .

  • @raghavibr7666
    @raghavibr7666 4 ปีที่แล้ว

    Hi Navin, Can we use the same logic for Span class as well ? Please reply

    • @vijaysadanand5287
      @vijaysadanand5287 4 ปีที่แล้ว +1

      @Raghavi Br I hope you have got the code for span class but below code worked for me where there is div and span tag included...
      driver.findElement(By.xpath("//div[contains(@class,'selected-dial-code')]")).click();

      List list = driver.findElements
      (By.xpath("//div[contains(@class,'flag-container')]//ul//li//span[contains(@class,'dial-code')]"));

      System.out.println(list.size());

      for (int i=0;i

  • @syedatif837
    @syedatif837 6 ปีที่แล้ว

    Hello Naveen- I have the same scenario where I need to select multiple options from the dropdrown but when I click on the dropdrown and try to find the xpath of the elements in the dropdown, it does not show the xpath of the elements. The ul tag for me is hidden and I got it after i pressed F12 in the UI. Its very difficult for me to capture the xpath of the dropdown elements as when i just come out of the dropdown list the ul gets hidden in html code

  • @sabrinsabrin566
    @sabrinsabrin566 6 ปีที่แล้ว +1

    How to write the code when select value which try to find out by index???

    • @syedatif837
      @syedatif837 6 ปีที่แล้ว

      Select selectElement=new Select();
      selectElement.selectByValue("value" ); here value is attribute of the options tag

    • @Anaris13
      @Anaris13 4 ปีที่แล้ว

      You can past index as a argument to your method and while you are looping just do :--> if(i==arg){ List.get(i).click(); }

  • @real_hello_kitty
    @real_hello_kitty 4 ปีที่แล้ว

    😊🙏

  • @saikirantelapalli8785
    @saikirantelapalli8785 6 ปีที่แล้ว

    Hello Naveen, what if i need to select multiple check boxes not all in the drop down and also its very difficult for me to capture the xpath of the dropdown elements as when i just come out of the dropdown list the ul gets hidden in html code

    • @smitanair5721
      @smitanair5721 6 ปีที่แล้ว

      You can use the or || operator to select multiple values in the if condition.

  • @vishnuvlog8030
    @vishnuvlog8030 4 ปีที่แล้ว

    you must need to show some different websites