How to Handle Bootstrap Dropdown in Selenium Webdriver

  Рет қаралды 101,269

Mukesh otwani

Mukesh otwani

Күн бұрын

Пікірлер: 154
@sk-creativemind7805
@sk-creativemind7805 3 жыл бұрын
Thank you Mukesh. It was helpful for me to achieve my task.
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Glad it helped Sayed
@AutoMaker
@AutoMaker 6 жыл бұрын
Hi, I working same in python, your demo is good. I also worked on it and produce it in Python 3.x for people. wonderful idea
@vivekshah907
@vivekshah907 8 жыл бұрын
Very much useful and simple in understanding. Thanks Mukesh!!
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Vivek, Glad to know it helped.
@knightofwisdom11
@knightofwisdom11 8 жыл бұрын
Thank you Mukesh... Continue with the useful tutorials...
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Welcome mate :)
@kirantherise1
@kirantherise1 8 жыл бұрын
ery much useful and simple in understanding. Thanks Mukesh!!
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
:)
@anilmadishetty
@anilmadishetty 4 жыл бұрын
Hi Mukesh, your videos are so easy to understand if you follow them from starting. Please could you post the Video for divtag Dropdown values also. Thank you so much.
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Anil, thank you. For div tag, span tag, li tag approach will be same.
@mbabajan
@mbabajan 7 жыл бұрын
Thanks Mukesh, Im trying for get dropdown list from Naukri.com to select cities, I was unable to get, But this video helped me to get.
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
HI Babaja, Thank and glad it helped. What exception you are getting? Can you paste code or send to mukeshotwani@learn-automation.com I will check.
@mbabajan
@mbabajan 7 жыл бұрын
www.naukri.com Itried for long time i didnt get the list, according to your video I practiced. it got. DropDown Country List and City List driver.findElement(By.name("city")).click(); Thread.sleep(2000); WebElement select = driver.findElement(By.cssSelector(".droopeCont.listing")); String xp= "//ul[@class='droopeCont listing']//li/div/div/div/span"; List options = select.findElements(By.xpath(xp)); System.out.println("Size of List is "+options.size()); // this is method1 getting dropdown list naukri.com for(WebElement element:options) { String innerhtml= element.getAttribute("innerHTML"); if(innerhtml.contentEquals("Patiala")) { element.click(); Thread.sleep(3000); break; } /* * This is method2 for getting dropdown list in naukri.com for(int i=0;i
@akulabhaskar3797
@akulabhaskar3797 6 жыл бұрын
Thanks Mukesh for crystal Clear Explaination
@shubhamchinchalkar5010
@shubhamchinchalkar5010 Жыл бұрын
Very good explanation
@Mukeshotwani
@Mukeshotwani Жыл бұрын
Thanks and welcome Shubham
@selvakumarv8094
@selvakumarv8094 8 жыл бұрын
Very good explanation Mukesh .. Thanks
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Welcome Selva
@molkotok
@molkotok 6 жыл бұрын
If you need select only 1 item, you don't need using loop for it. Just use xpath and select only one item that you need. Exemple : //a[text()[contains(.,"JavaScript")]]
@AshishDubeyash4you
@AshishDubeyash4you 5 жыл бұрын
Right, but the code which Sandeep has created is Robust & Maintenance wise it is easy. What if next time you want to select some other item. In that Scenario you would need to change Xpath again. When developing code, first thing we should have in our mind, if there any change would come then how easy would it be to maintain.
@fhusain382
@fhusain382 7 жыл бұрын
Thanks Mukesh. This was very helpful :)
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Welcome Salman
@MuhammadAhmad-by2rr
@MuhammadAhmad-by2rr 3 жыл бұрын
Thank you bro. this helped me a lot
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Thank you 🙏 Ahmed
@sonuutbe
@sonuutbe 6 жыл бұрын
Very nice explanation the way we need to handle the BS dropdowns .. :)
@jithinsomaraj
@jithinsomaraj 3 жыл бұрын
it was very useful.Thank you
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Glad to hear that Jithin
@biradarshweta1762
@biradarshweta1762 3 жыл бұрын
Hi mukesh sir This video helped me a lot and I can easily understand the concepts. but when we using get attribute method what are value we need writes as argument.
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Hi Shweta I did not get your question, can you please provide few more details on this?
@mauryar16
@mauryar16 3 жыл бұрын
shweta, you can pass any argument that were written inside the tag..like Id, name, class, value...based on requirements
@nagagsalka5371
@nagagsalka5371 8 жыл бұрын
Thanks for this clip.............bootstrap regards Nag
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks Nag
@dfwguy03
@dfwguy03 7 жыл бұрын
Can you please do a video on Kendo Dropdowns! i am having a lot of trouble selecting options from a dropdown list with kendo!
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Sure mate I will do that.
@ruchitasingh7319
@ruchitasingh7319 6 жыл бұрын
element.click(); not working(not clicking on dropdown option )
@amardeeppatil5444
@amardeeppatil5444 8 жыл бұрын
Hi Sir, I like your tutorial , learn a lot from your videos, sir can you suggest me how to handle autocomplete textfield with selenium webdriver
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Amardeep its easy just use findElements method and try to capture all elements which comes with auto suggestion and use loop.
@vijaymakwana9287
@vijaymakwana9287 4 жыл бұрын
Hi Mukesh I am getting output but after If statement its not clicking on chrome page. After drop down lets say if i want to click CSS i am getting output and its breaking but its not going on CSS page
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi VIjay, can you share your code?
@vijaymakwana9287
@vijaymakwana9287 4 жыл бұрын
@@Mukeshotwani Hi Mukesh All good I was putting CSS to match But finally i realized that CSS has no other page So it was clicking but other page was not opening Then i change to java script and it works Thank you mukesh Your videos are awesome Thank you
@positivevibes1769
@positivevibes1769 3 жыл бұрын
thank you mukesh it helps me lot
@deekshithb5459
@deekshithb5459 5 жыл бұрын
hi mukesh here your are using a xpath which will match all the elements ........... what is the need to use that even you can find individual xpath of each particular element by relative xpath
@greenpeace041
@greenpeace041 7 жыл бұрын
@mukesh I came up with the situation where two matching node for [//ul[@class='dropdown-menu'] ] If you refer video @ 7:18 in this case I can move forward . Thanks in advance
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Santosh I have explained the same thing in below video. kzbin.info?o=U&video_id=9N7ERYWbjuw
@greenpeace041
@greenpeace041 7 жыл бұрын
I am not able to open provided video link , Do I need to pay for it.
@greenpeace041
@greenpeace041 7 жыл бұрын
Thanks for response Mukesh
@varundutta2381
@varundutta2381 7 жыл бұрын
Hi Mukesh, In this video you have used Chrome driver but you have not set the property for chrome driver..Then how it ran ?
@harshitagrawal7672
@harshitagrawal7672 2 жыл бұрын
Hi Mukesh, I used the below code and it worked, pls confirm if its correct or it might be problematic: List ddMenu = driver.findElements(By.xpath("//ul[@class= 'dropdown-menu']//li//a")); for (WebElement ele : ddMenu) { // String values = ele.getAttribute("innerHTML"); String values = ele.getText(); if (values.equals("JavaScript")) { ele.click(); break; } System.out.println(values); }
@Mukeshotwani
@Mukeshotwani 2 жыл бұрын
Hi Harisht looks good to me. You can create lib for this and can reuse this.
@kalpn9116
@kalpn9116 6 жыл бұрын
Hi Mukesh, I have used same program which you showed for blocking Chrome Notifications. But am not able to block that notification.could you please give details explanation why we use Has map and how to click the block button. Please help me. If you upload video for this it would be helpful.
@Bonn799001
@Bonn799001 5 жыл бұрын
Hi Mukesh..thanks for helping for yesterday' s issue. Can you please tell can we execute our scripts without login application.. I mean just bypassing the login where application should be opened state as we do in UFT. Even I know htmlunit webdriver is another option but I want to see the application bebavior.
@toblyzausa
@toblyzausa 6 жыл бұрын
Hi mukesh, i am new in test automation and i would be very happy if you can help me in python selenium for the following topic 1. Date Picker 2. Dropdown select bootstrap with no value 3. Dropdown with tags or value
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Hi Zausa I have uploaded using Java but for Python also I will upload soon.
@toblyzausa
@toblyzausa 6 жыл бұрын
Having a problem as well with ImportError: cannot import 'keys' :(
@vipjewelyracer4412
@vipjewelyracer4412 6 жыл бұрын
Hi Mukesh! How about in handling collapse and expand button? it is the same with bootstrap dropdown?
@beautifulnails3102
@beautifulnails3102 7 жыл бұрын
Hey Mukesh. This is Jessie. I actually am trying to execute the same exact program but am unable to print the options in the drop down menu. Everytime I try to do that, it is printing as "null". Please guide me through this.
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hey Jessie, Which application you are testing and please provide code as well.
@bangarimalleshkumar8010
@bangarimalleshkumar8010 8 жыл бұрын
simply you are awesome! mukesh but i have a doubt on the script "Will it work without setting System.setPropery("","") before Webdriver driver = new ChromeDriver() on mac for ChromeDriver?".
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hey Mallesh, I did following step to run on MAC learn-automation.com/chrome-browser-on-mac-using-selenium/
@bangarimalleshkumar8010
@bangarimalleshkumar8010 8 жыл бұрын
Thank you very much Mukesh :)
@abhishekjha7073
@abhishekjha7073 6 жыл бұрын
Used the same algo but got returned with the below exception- Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: Element could not be scrolled into view Any clues why does it happen?
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
HI Abhishek, I have another video on the same learn-automation.com/how-to-scroll-into-view-in-selenium-webdriver/
@vinkss8547
@vinkss8547 3 жыл бұрын
Hi,i have been trying bootstrap with python code .My question is why cant we do element.text(i tried but its not working in my python code) and why element.getattribute(which works fine as it displays all the dropdowns)
@dfwguy03
@dfwguy03 7 жыл бұрын
Question - Can these (bootstrap) type of dropdowns only be found using xpath?
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
yes we can find using XPATH.
@TheNik20ne
@TheNik20ne 7 жыл бұрын
Values from dropdown is ==== Profile Values from dropdown is ==== Logout i am getting this output. when i try to print elements. how can i select perticular element? please guide
@gopinathanpazhani4393
@gopinathanpazhani4393 6 жыл бұрын
Hi mukesh Have you made tutorial vedio for Android automation using appium.
@nunnaveeraprasad1
@nunnaveeraprasad1 7 жыл бұрын
hi guys, can u please post Video of this functionality in C#
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Prasad I am not good in C#
@kalpitamankame2012
@kalpitamankame2012 6 жыл бұрын
HI Mukesh, I followed exactly as you shown in this video as my application also has the same type of dropdown. But then too it is not working at my end. It is giving me an error at finding the ul class. You have shown it via xpath method but now the xpath dowsnt work in latast mozilla. Can you please show another method or alternative?
@ketakinaik9770
@ketakinaik9770 7 жыл бұрын
Hi Mukesh, I tried using your code, but its throwing null pointer when i am trying to click on heading of the dropdown, say for example inn your case its "Tutorial", when i m trying to click on that I am getting null pointer exception.. Can you advice something ?
@chbalaji5394
@chbalaji5394 6 жыл бұрын
Hi Mukesh, im getting the complete li tag instead of inner text.
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Yes Balaji once you get all information as String then you can play with data. Use String class to handle data kzbin.info/www/bejne/iKbYqqeaocR5arc
@rohanbhandari4084
@rohanbhandari4084 7 жыл бұрын
hi..can you please share link of your blog where bootstrap drop down option i available....its not visible in video...
@akshadapawar2629
@akshadapawar2629 3 жыл бұрын
Hi mukesh,in my url there is no mension dropdown or list when inspect how i can handle?
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Hi Akshada, please use Select class if you have a Select tag or use findELements with List approach.
@prateekkrishnatrey271
@prateekkrishnatrey271 7 жыл бұрын
Hi mukesh, can u help me out in "how to handle auto suggestion using selenium webdriver"
@kalpn9116
@kalpn9116 6 жыл бұрын
Hi Mukesh, i was trying to automate gmail sign up form where they handled drop downs in Div tag instead of a.then also am getting many duplicates and total size showing as more than 12 months. Could you please help me how to handle dropdown if it is in Div tag.
@saurabhvhasakale3
@saurabhvhasakale3 5 жыл бұрын
Sir I m getting Null pointer Exception at the line for(innerhtml. ContentEquals(HTML)
@chandanrai6302
@chandanrai6302 6 жыл бұрын
hi mukesh sir please help me in resolving the issue suppose suppose togather with javascript i want to select multiple option like javascript,html,css
@ARTofSelenium
@ARTofSelenium 7 жыл бұрын
Hi, When I have tried the above program, all I am getting is : INFO: Detected dialect: W3C after this the program does not go further neither is displays any result or error
@gangireddy6757
@gangireddy6757 4 жыл бұрын
Hi Mukesh can you post divtag Dropdown video please
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Gangi, this approach will be same for any kind of dropdown like div, span, li etc
@venkataramanap5453
@venkataramanap5453 7 жыл бұрын
how to write the xpath if the html code contains span
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Venkata, Please follow below guide for xpath learn-automation.com/how-to-write-dynamic-xpath-in-selenium/
@attitudelove4517
@attitudelove4517 2 жыл бұрын
Hi Mukesh, How to automate the Material UI dropdown?
@girishnair546
@girishnair546 5 жыл бұрын
Hi Mukesh, why didn't you use gettext() to get drop-down text won't it work
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Girish you can use getText or getAttribute("innerHTML") both does the same thing.
@annetnancy3791
@annetnancy3791 6 жыл бұрын
Hi sir, I want to give drop-down value from Excel... How to do it by using this method?
@towhidskynet
@towhidskynet 7 жыл бұрын
what is the difference between normal dropdown and bootstrap drop down? both methods seem to be same.
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Nopes Towhid. For normal dropdown we use Select class and for bootstrap we use List and then iterate.
@towhidskynet
@towhidskynet 7 жыл бұрын
Oh, I have been using the List+iterate method for both cases. Good to know about Select Class :)
@anshukumar8377
@anshukumar8377 8 жыл бұрын
nice explanation..but i have 2 doubts..in ur xpath //ul[@class='dropdown-menu']//li/a....u have used //li before /a..so y double slash before li here,from parent to node we can use single slash??one more doubt is we can use text() function to select "javascript" in above example..javascript text is given easily.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Anshu, you can use / also and u can directly give //a after ui Another - Yes you can use Text() method of xpath as well.
@samairapal4594
@samairapal4594 8 жыл бұрын
Hi Mukesh, i have done the same thing but its not returning me the innerhtml values its returning me the null values.
@rashmichaudhari9348
@rashmichaudhari9348 5 жыл бұрын
Hi Please help me to solve this error "Element should be 'select' but 'span' "
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Rashmi, any url where I can find this issue?
@condra3786
@condra3786 6 жыл бұрын
many many thanks.
@jyotibhuyan1042
@jyotibhuyan1042 7 жыл бұрын
Hi Mukesh..Instead of usring innerHTML concept, can we use .getText() function? I have used below for loop and its working the same. Could you please tell me if this code will work in all BootStrap dropdowns or any issue with this code? for(WebElement ele:dd_value) { String DropDownValue=ele.getText(); if(DropDownValue.contentEquals("JavaScript")) { ele.click(); break; } System.out.println("Value of Drop down:####" +DropDownValue); }
@vaishalilahudkar2795
@vaishalilahudkar2795 3 жыл бұрын
What is diff betn normal drop down and bootstrap dropdown
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Hi Vaishali, Normal Dropdown have select tag and rest all dropdowns dont have select tag.
@vaishalilahudkar2795
@vaishalilahudkar2795 3 жыл бұрын
@@Mukeshotwani thank you so much sir for confirming.
@snehal_5474
@snehal_5474 2 жыл бұрын
There are total 41 elements but I am getting null innerhtml error...there is also innertext present
@A_philodendron
@A_philodendron 4 жыл бұрын
Hi mukesh..this vedio helpled me a lot. But, can u pls throw some light on providing data(java script, in this case) at run time instead of giving it in the code.
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Nikhitha, you can make method and pass data as parameter.
@NeoNeoza
@NeoNeoza 7 жыл бұрын
Great video. what i want to understand is where did you get "Inner Html" from ? or is it just a name ?
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Neo innerHTML is just attribute to get inner text
@NeoNeoza
@NeoNeoza 7 жыл бұрын
Thank you so much for this video. i am new to Selenium and this was helpful
@Khetandod
@Khetandod 6 жыл бұрын
Mukesh sir When i work on eclipse with Selenium my laptop get too much time to execute script. What I will do to make it faster ? Please suggest me.
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Sameer it depends on your system configuration.What configuration you have ?
@Khetandod
@Khetandod 6 жыл бұрын
Hp pavilion 2GB RAM, 1.8GHz processer, 500GB DDR3 HD. I format it but still issue not solve.
@AshishDubeyash4you
@AshishDubeyash4you 5 жыл бұрын
@@Khetandod Please upgrade configuration of Laptop. 4GB RAM & I3 Processor will work better.
@bibhutijha1113
@bibhutijha1113 7 жыл бұрын
i am getting all the innerhtml . but after ele.click the script is getting error .. Could not click the element
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Bibhuti what is the error it is coming? Can u please paste the logs.
@bibhutijha1113
@bibhutijha1113 7 жыл бұрын
org.openqa.selenium.ElementNotVisibleException: Cannot click on element (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 206 milliseconds Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35' System info: host: 'DEVSRF4015', ip: '10.253.6.62', os.name: 'Windows NT (unknown)', os.arch: 'amd64', os.version: '6.2', java.version: '1.6.0_23' Session ID: 36d08239-a981-434f-b7cc-4ec63504c745 Driver info: org.openqa.selenium.ie.InternetExplorerDriver ----------------------------------------------------------Dom--------------------------------------------- Actions Add comment Adjust balance Determine insurance receivable billing status Demand claim rebill Demand insurance claim for BP Hold/Release insurance collection activity (manual hold) Maintain secondary business office Transfer Balance View Denial Details View follow-up history -------------------------code-------------------------------------------------- WebElement actionbtn=driver.findElement(By.id("ctlRPBPActionsInsBtn")); actionbtn.click(); System.out.println("menu button clicked"); Thread.sleep(2000); List list = driver.findElements(By.xpath("//span[@id='ctlRPBPActionsInsSpan']/table/tbody//tr/td")); //wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ctlDemandClaim"))); for (WebElement ele : list) { // for every elements it will print the name using innerHTML System.out.println("Values " + ele.getAttribute("innerHTML")); // Here we will verify if link (item) is equal to Java Script if (ele.getAttribute("innerHTML").contentEquals("Demand insurance claim for BP")) { // if yes then click on link (iteam) ele.click(); // break the loop or come out of loop break; } }
@bibhutijha1113
@bibhutijha1113 7 жыл бұрын
Using java script i am able to click but what is the issue with the above code :(
@arshdeepkaur2860
@arshdeepkaur2860 5 жыл бұрын
Hi Mukesh, I am trying to automate a drop-down and there is no unique_id given, no select tag or list. All elements are given under div tag and even drop-down elements are defined under div tags. How to handle such type of drop-downs
@AshishDubeyash4you
@AshishDubeyash4you 5 жыл бұрын
Please give me link of URL where dropdown is & I will help you in creating Xpath for it.
@bunnyonbike4205
@bunnyonbike4205 6 жыл бұрын
Hi Mukesh, I really having trouble in writing logout script for flipkart. can you please help me with code or making a video on log out program of flipkart. Thanks.
@soumyaranjanhota9475
@soumyaranjanhota9475 3 жыл бұрын
how to handle a dropdown which is in input & datalist tag
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Hi Soumyaranjan process is same for all kind of dropdown.
@siddharthsharma2926
@siddharthsharma2926 6 жыл бұрын
I am not able to find the xpath as you are able to find
@krishnauppara1805
@krishnauppara1805 8 жыл бұрын
hi sir if one of option is disable how to verify that option is disable
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Krishna, Good question, if any of the option is disble then that option must be having one more property so based on that you can verify whether element is disble or not.
@vinitpatil3104
@vinitpatil3104 7 жыл бұрын
Hello Mukesh Sir, If the dropdown is fetch dynamically using Angular JS on that dropdown the Another Dropdown is Changing its content then how can we automate that type of DropDowns Really Need Your Help in this :-)
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Vinit you can apply the same logic but for next dropdowns you can use explicit wait to handle sync issues. learn-automation.com/explicit-wait-in-selenium-webdriver/
@vinitpatil3104
@vinitpatil3104 7 жыл бұрын
thanku
@prabakaran7581
@prabakaran7581 7 жыл бұрын
Hi Mukesh. Can I use the same technique for gmail registration page, month drop down ?
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Prabha have you tried any code from your side?
@prabakaran7581
@prabakaran7581 7 жыл бұрын
This is my code. But its not working. WebDriver driver = new FirefoxDriver(); driver.get("accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default"); Thread.sleep(3000); driver.findElement(By.xpath(".//*[@class='goog-inline-block goog-flat-menu-button jfk-select']")).click(); Thread.sleep(3000); Listmenu=driver.findElements(By.xpath(".//*[@class='goog-menuitem-content']")); Thread.sleep(3000); for(int i=0;i
@GauravSingh-pc6jc
@GauravSingh-pc6jc 7 жыл бұрын
I am also facing the same issue. Here is what i tried @Test public static void dropdownForGmail() { WebDriver driver = new FirefoxDriver(); driver.get("www.gmail.com"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.xpath("//a[contains(text(),'Create account')]")).click(); String str = driver.findElement(By.xpath(".//*[@id='wrapper']/div[2]/h1")).getText(); System.out.println("Title of the Page:" + str); driver.findElement(By.xpath(".//*[@id='FirstName']")).sendKeys("Ferminio"); driver.findElement(By.xpath(".//*[@id='LastName']")).sendKeys("Liverpool"); driver.findElement(By.xpath(".//*[@id='GmailAddress']")).sendKeys("BunFerminioUnique"); driver.findElement(By.xpath(".//*[@id='Passwd']")).sendKeys("NoPassWordIsSafe"); driver.findElement(By.xpath(".//*[@id='PasswdAgain']")).sendKeys("NoPassWordIsSafe"); driver.findElement(By.xpath("//div[@title='Birthday']")).click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); List dropdown = driver.findElements(By.xpath(".//span[@id='BirthMonth']/div[2]/div/div")); System.out.println(dropdown.size()); for(int i =0; i < dropdown.size();i++) { WebElement ele = dropdown.get(i); String innerHtml = ele.getText(); System.out.println("present for date of month == "+ innerHtml ); if( innerHtml.contentEquals("March")) { System.out.println("Value present for date of month == "+ innerHtml ); ele.click(); break; }
@anmolverma2989
@anmolverma2989 5 жыл бұрын
how to find x path in chrome,,,,help me
@AshishDubeyash4you
@AshishDubeyash4you 5 жыл бұрын
Follow this syntax //tagname[@attribue='value'] .. For eg: //input[@name='firstname'] this xpath will help you to locate FirstName textfield of FB Sign Up Page.
@hariprasadyadavali2524
@hariprasadyadavali2524 7 жыл бұрын
Hi Mukesh, I tried using your code, but it throws null pointer exception.Mentioning below code.Can you please advice me what I did wrong? package day1; import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class TestGmailRegistration { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver","D:\\Selenium\\Browser Drivers\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("accounts.google.com/SignUp?service=mail&continue=mail.google.com/mail/?pc=topnav-about-en"); driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS); driver.findElement(By.id("FirstName")).sendKeys("Sri"); driver.findElement(By.xpath(".//*[@id='LastName']")).sendKeys("Kumar"); driver.findElement(By.id("GmailAddress")).sendKeys("srikumar@gmail.com"); driver.findElement(By.xpath("//span[@id='BirthMonth']")).click(); Thread.sleep(3000); Listmntlist = driver.findElements(By.xpath("//div[@class='goog-menuitem-content']")); for(int i=0;i
@m-motive
@m-motive 7 жыл бұрын
Pls change xpath for mntlist as "//div[@class='goog-menuitem']/div" and write "innerhtml" as "innerHTML" Its working for me
@katerinayagodina719
@katerinayagodina719 7 жыл бұрын
Hi Mukesh. Thank you so much for your tutorial-Very helpful. I am facing an issue- I am trying to locate a drop-down frame element and can't make it (www.educationdynamics.com/contact-us) This is Choose Department or Service section. THANKS A LOT
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Eka I just checked your site and found that it has Select tag with it. In this case you can use Select class of Selenium Webdriver learn-automation.com/handle-dropdown-in-selenium-webdriver/
@namratachandegave2732
@namratachandegave2732 5 жыл бұрын
Where i can see video description ?
@BhushanPatil-pf4kn
@BhushanPatil-pf4kn 7 жыл бұрын
Hi Mukesh, Thanks for wonderful video. I am testing a demo website but it produce a error regarding Country dropdown --" Unable to locate element: {"method":"xpath","selector":"html/body/div[3]"} ". I had tried to identify same dropdown by ID, CSS and XPATH, but still I am facing same issue. Link:- www.phptravels.net/admin Login MailID:- admin@phptravels.com Login Password:- demoadmin Flow:- Account --> Admin --> Click on Add button Please provide sloution and thanks once again.
How to verify page title in Selenium Webdriver
10:47
Mukesh otwani
Рет қаралды 89 М.
Handling of Bootstrap Dropdowns using #Selenium WebDriver | Selenium |
37:03
Bend The Impossible Bar Win $1,000
00:57
Stokes Twins
Рет қаралды 42 МЛН
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 26 МЛН
女孩妒忌小丑女? #小丑#shorts
00:34
好人小丑
Рет қаралды 100 МЛН
How to handle Bootstrap DropDown in Selenium - Session - 19
38:12
Naveen AutomationLabs
Рет қаралды 90 М.
Explicit Wait in Selenium Webdriver
18:08
Mukesh otwani
Рет қаралды 90 М.
Handle Dynamic Radio Button and Check Box in Selenium Webdriver
16:47
Mukesh otwani
Рет қаралды 134 М.
Enter Text into a Textbox using JavascriptExecutor in Selenium WebDriver
17:11
Mastering Chaos - A Netflix Guide to Microservices
53:14
InfoQ
Рет қаралды 2,2 МЛН
Handle Hidden Drop Down Values / Auto Suggestions using DOM Trick | EventListener
7:55
Я КУПИЛ СЕБЕ КЛАВИАТУРУ С ЭКРАНОМ
0:36
Xiaomi or Samsung #satisfying #colormixing #sharkzhan
0:19
Shark Zhan
Рет қаралды 17 МЛН
Почему хакеры выбирают линукс??
0:43
Honey Montana
Рет қаралды 63 М.
Игровые ПК за 20 и 40 тысяч рублей
27:07
Ремонтяш
Рет қаралды 274 М.