How to Handle Dropdown in Selenium webdriver

How to Handle Dropdown in Selenium webdriver

Mukesh otwani

8 лет назад

203,567 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@mustafak9954
@mustafak9954 - 10.06.2020 02:23

I have paid $400 for Udemy to learn online and they couldn't explain this drop-down thing at all , it sucked but you made it look so easy ... Just superb 👌

Ответить
@divyacm5004
@divyacm5004 - 31.10.2021 10:19

Hi Sir, After selecting, I'm trying to deselect same, selection is working but deselect is throwing expection like below. Please guide me.
Code: WebElement Year =driver.findElement(By.cssSelector("select[id='year']"));
Select Year1=new Select(Year);
Year1.selectByVisibleText("1995");
System.out.println(Year1);
Thread.sleep(3000);
Year1.deselectByVisibleText("1995");
System.out.println(Year1);

Expection : java.lang.UnsupportedOperationException: You may only deselect options of a multi-select

Ответить
@abhishekmukherjee9865
@abhishekmukherjee9865 - 17.09.2021 19:29

How to handle dropdown when the element is present in nested iframe. Pls let me know

Ответить
@banuyaswanth8061
@banuyaswanth8061 - 29.08.2021 05:19

please could you help me... to print even numbered years in a dropdown... if u know please upload one video regarding that

Ответить
@alexalex2343
@alexalex2343 - 27.07.2021 16:19

HI Mukesh, This video is very helpful for me. Thanks for this video.

There is one drop down and in which having the colors(style="background-color: rgb(186, 182, 182);) so I am not able to handle this dynamically. Even dont have text of colors in tag. can you please help me to sort out this?

Here Im not able to attach any screenshot.

Ответить
@nabilferhoune9293
@nabilferhoune9293 - 23.06.2021 19:13

think you for video,i have probem when the page facebook open ,a dialog page opens to accept cookies,what i can i do (i use chrome)thinks

Ответить
@muhammadshahnawaz9953
@muhammadshahnawaz9953 - 19.05.2021 15:53

Thanks mukesh.

Ответить
@rahulgaonkar8214
@rahulgaonkar8214 - 18.03.2021 16:50

Please send me the code with that assert

Ответить
@prajaktajadhav4429
@prajaktajadhav4429 - 09.03.2021 14:36

Where is part 2 of this video where in you have explained the 2nd one i.e handling drop-down without select tag..pls provide the link . Didn't you take the same example which you demonstrated here

Ответить
@gilsonsouza8159
@gilsonsouza8159 - 29.01.2021 22:39

Hi, I have a question regarding Selenium.

let's say that I am using selenium to create a routine automation instead of an test automation.

And this routine will help not just me but others colleagues also. These colleagues don't know anything about programming. So I wish I could create some "desktop application".

like an icon that they just click on it and the script will run. Without need of the Eclipse IDE or anything else.

The point is that the webdriver follow a path, and this path is from my computer. also, there is a file, and the path if from my user. so I not sure on how to do it

Can you help with that? I appreciate, thank you so much.

If you know some other way, it is not necessary to be a desk app, could be online, on a server, I don't know.

Ответить
@fathima9716
@fathima9716 - 01.12.2020 21:18

Hi Mukesh, Im wondering how is your script working without setting system.set property?

Ответить
@saraswathiperamsetty6829
@saraswathiperamsetty6829 - 03.11.2020 16:38

And could you please make a video for how to login gmail in c# using Selenium.

Ответить
@Zack-ni3vz
@Zack-ni3vz - 14.10.2020 18:08

Can you please show us, how to automate a date-picker?

Ответить
@johndoe-lz8fo
@johndoe-lz8fo - 24.09.2020 06:47

what is the dropdown disappears before you can inspect it? like on amazon?

Ответить
@alinrabbi2468
@alinrabbi2468 - 11.08.2020 07:54

Awesome

Ответить
@chauhanrahul155
@chauhanrahul155 - 04.08.2020 16:51

i am not able to get run as java application option.What should I do?

Ответить
@jarvisfriday7452
@jarvisfriday7452 - 20.07.2020 18:18

How to fetch the unselected options in the drop down?

Ответить
@najibassaadi5598
@najibassaadi5598 - 19.07.2020 06:54

Thanks for the great explanation! I wish you the best!

Ответить
@mohitswar301
@mohitswar301 - 15.07.2020 11:59

How to select dropdown which doesnot have select tag?

Ответить
@ankittiwari9040
@ankittiwari9040 - 13.06.2020 09:27

Hi Sir, first of all great video,
Can you please explain
WebElement month_dropdown =driver.findElement(By.id(“month”); syntax. I didn’t understand why are you giving this.

Ответить
@curious6899
@curious6899 - 02.06.2020 00:33

(1) In a drop-down where you can only select one option from and the drop-down is coded using DIV or SPAN tags (NOT the Select tag). How to click a drop-down option there ? (2) How to achieve that goal using Actions class ?

Ответить
@sohelahmadkhan1775
@sohelahmadkhan1775 - 13.05.2020 08:52

How to handle if span is present instead of select.

Ответить
@nehakannegulla4065
@nehakannegulla4065 - 28.04.2020 00:09

Is there any tutorials on assert for verifying whether the test is passed?

Ответить
@studywithroshan3179
@studywithroshan3179 - 11.03.2020 18:25

Sir how to handle kendoDropDownList using selenium

Ответить
@harshinisuryamuthukrishnan4822
@harshinisuryamuthukrishnan4822 - 27.01.2020 08:42

how do u do the dropdown with div type of codes?

Ответить
@rohinimahajan9759
@rohinimahajan9759 - 23.01.2020 08:42

sir how can we test ui drop down

Ответить
@Dee-oi8jl
@Dee-oi8jl - 26.12.2019 23:11

Hi Mukesh, I really like the way you are teaching, May in know how to verify go to one drop down(select with for loop) to another drop down(select with for loop) and add value in the text box and remove value from last text box and again go to 2nd drop down and select value and go to 3 next text box and add value and remove value (i have tried so many way but its not working if you can, can you please help me with this)

Ответить
@RaviBhushanGupta
@RaviBhushanGupta - 30.11.2019 17:10

why you are using TestNG. in the previous video you did by different steps..I am getting confused

Ответить
@seemakaushal2212
@seemakaushal2212 - 29.11.2019 19:53

what if the html tag is not select, you mentioned in the begining of the vid, but didnot t al about it in the vid

Ответить
@kareembasha9351
@kareembasha9351 - 20.10.2019 06:11

thank you soo much sir.

Ответить
@gayatrimungarwadi390
@gayatrimungarwadi390 - 17.07.2019 12:31

@mukesh how to handle search and select type of dropdown values?

Ответить
@dayanasilveira1450
@dayanasilveira1450 - 01.07.2019 18:09

Hi thank you for your video but I'm unable to select a value from a dropdown which shows the States you can see in the following html tag:
<div class="col-sm-4 form-group">
<label id="xstateLabel">@lang('messages.state')</label>
<select class="form-control js-select" style="width: 100%" <?php if (strpos($lockedfield, 'state') !== false) {echo 'disabled xlocked="true"';}else {echo 'xlocked="false" onblur=""';} ?> id="xstate" name="xstate">
<option value="">@lang('messages.state')</option>
<option value="AL" <?php if(isset($usr->state) && $usr->state=='AL'){echo 'selected';} ?>>Alabama</option>
<option value="AK" <?php if(isset($usr->state) && $usr->state=='AK'){echo 'selected';} ?>>Alaska</option>
<option value="AZ" <?php if(isset($usr->state) && $usr->state=='AZ'){echo 'selected';} ?>>Arizona</option>
<option value="AR" <?php if(isset($usr->state) && $usr->state=='AR'){echo 'selected';} ?>>Arkansas</option>
<option value="CA" <?php if(isset($usr->state) && $usr->state=='CA'){echo 'selected';} ?>>California</option>
<option value="CO" <?php if(isset($usr->state) && $usr->state=='CO'){echo 'selected';} ?>>Colorado</option>
<option value="CT" <?php if(isset($usr->state) && $usr->state=='CT'){echo 'selected';} ?>>Connecticut</option>
*
*
*
</select>
</div>

I created the java function:

public void select() {
Select drpState = new Select(driver.findElement(By.id("xstate")));
drpState.selectByValue("CA");
}


and
public void select() {
WebDriverWait wait = new WebDriverWait(driver, 10);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("xstate")));

Select drpState = new Select(driver.findElement(By.id("xstate")));

drpState.selectByValue("CA");

}
But I'm getting the error:

org.openqa.selenium.ElementNotVisibleException: element not interactable: Element is not currently visible and may not be manipulated
(Session info: chrome=75.0.3770.100)
...

Any suggestions please, I have been looking for a solution to this error for a some weeks. Thank you very much in advance

Ответить
@bajishaik429
@bajishaik429 - 28.03.2019 14:11

Hi Mukesh,


Could you please tell me "how to validate unique text value for particular field by using selenium??? for example, while registering Gmail we have to provide our unique gmail Id. like the same for validating such a field what the code required?? I hope you got the point. Please suggest me Mukesh or any one knows tell me....

Ответить
@goldfinger1528
@goldfinger1528 - 08.02.2019 20:32

Thank you, makes so much sense. A question though- how do you handle cases where other elements obscure the dropdown?

Ответить
@ajinkyapawar3440
@ajinkyapawar3440 - 22.01.2019 07:00

Hi Mukesh,
How to select multiple items in selected dropdown .
ex one dropdown country and we have to select two country i.e. India and China at one time is this possible????

Ответить
@deekshithb5459
@deekshithb5459 - 18.01.2019 20:28

Hi Mukesh in this video u told that you will make extension video for this tutorial but where is that one.

Ответить
@vaishalipatil3364
@vaishalipatil3364 - 04.01.2019 12:49

How to handle dropdown in selenium using <Span> tag in HTML

Ответить
@vaidehipatil506
@vaidehipatil506 - 12.12.2018 01:07

Hi Mukesh,
Thanks for the video. I'm beginner in Automation. Could you please explain me why you didn't set any property for FirefoxDriver in this program ? Whenever I create new project or new class its trowing me an error. Please explain me. Thanks in Advance

Ответить
@mannuhunasigi
@mannuhunasigi - 25.11.2018 06:31

Hi Mukesh.. Need a help.. As you have mentioned in the video for Gmail application. the dropdown we need to select and display is using div tag. Pls let me know whether u have video for that..I have an application where i need to select and display dropdown by using input and div tag..Need to traverse from start to end by writing dynamic xpath

Ответить
@raveenabirua3380
@raveenabirua3380 - 09.11.2018 21:26

Ur videos are really very helpful. Thanks for ur great effort. Please guide me with assertion

Ответить
@rockyrockstar1386
@rockyrockstar1386 - 30.10.2018 09:14

Hi. Mukesh can u plz suggest me how to handle kendo dropdown

Ответить
@arshdeepkaur2860
@arshdeepkaur2860 - 28.10.2018 07:03

Hi Mukesh, I couldn't find your video for handling drop-downs with div tags. All the content I am trying to automate is under div tags. There is no li or select tags.

Ответить
@Bell4Fun
@Bell4Fun - 19.10.2018 02:52

Nicely Explained :-P

Ответить
@Bell4Fun
@Bell4Fun - 19.10.2018 02:07

In this example 1 if I chose to have following code
month_dd.selectByIndex(2);
month_dd.selectByValue("2");

if both code return same results then what is the difference between selectByIndex and selectByValue?
or
I am missing something ...

Ответить
@shreyajain9439
@shreyajain9439 - 11.08.2018 14:32

Hi Mukesh,
Can you please tell how to select value from autocomplete drop down in selenium.
Thanks in advance:)

Ответить
@dineshreddymallela
@dineshreddymallela - 24.07.2018 22:46

As you mentioned in video there is another scenario if we have div tag can you let me know where can i find video with div tag

Ответить
@sambapathi181
@sambapathi181 - 17.07.2018 19:56

hi
how to select drop downs in" data driven frame work"

Ответить