Not able to select the item in t drop down list.

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Not able to select the item in t drop down list.

PGF Bangalore English
Hi,

I was trying to select the item in drop down list.Drop down button is clicked but item is not selected .I have used this code.

@FindBy(xpath="//select[@id='requestreason']")
    private WebElement reuestReasonListbox;
   
    public void selectRequestReason()
    {
    reuestReasonListbox.click();
    Select sel = new Select(driver.findElement(By.id("requestreason")));
        sel.selectByVisibleText("STARS");
    //sel.selectByIndex(3);
    }
   
Can any one suggest me the solution.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/304ff8af-363d-446a-8171-126ee61ed80c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Not able to select the item in t drop down list.

Monika Singhal
It will be great if you can attach the screenshot
of the drop down HTML.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9f972968-9620-4bfe-8b2e-790406ac1190%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
Hi Monika,

I have attached drop down HTML.Can you please check once.

On Tuesday, June 6, 2017 at 10:58:00 PM UTC-4, Monika Singhal wrote:
It will be great if you can attach the screenshot
of the drop down HTML.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a340c178-9d69-42bd-945a-36aef7085772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dropdown_HTML.PNG (39K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Akshat Gupta
In reply to this post by PGF Bangalore English
Try this,


new Select(driver.findElement(By.id("<Enter id of the object>"))).selectByVisibleText("<Enter Option Text>");


Let me know if you face any problem.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3b169e10-33a9-4c20-ba07-a70d40030ea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Monika Singhal
In reply to this post by PGF Bangalore English
I have tried with your HTML. You don't have to write this line:
reuestReasonListbox.click();

Please modify your code to:

System.setProperty("webdriver.gecko.driver", "src/geckodriver");

WebDriver driver = new FirefoxDriver();

driver.get("link of your website");

Select select= new Select(driver.findElement(By.id("requestreason")));

select.selectByVisibleText("Medicare Risk Review");



On Tuesday, June 6, 2017 at 7:26:35 PM UTC+5:30, PGF Bangalore English wrote:
Hi,

I was trying to select the item in drop down list.Drop down button is clicked but item is not selected .I have used this code.

@FindBy(xpath="//select[@id='requestreason']")
    private WebElement reuestReasonListbox;
   
    public void selectRequestReason()
    {
    reuestReasonListbox.click();
    Select sel = new Select(driver.findElement(By.id("requestreason")));
        sel.selectByVisibleText("STARS");
    //sel.selectByIndex(3);
    }
   
Can any one suggest me the solution.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/053ce1e5-3971-4599-a32a-662929394547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
In reply to this post by Akshat Gupta
Hi Akshat,

I have tried but it's not working. Type mismatch  can't convert from void to select 

Select sel = new Select(driver.findElement(By.id("requestreason"))).selectByVisibleText("HEDIS");



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c68d97d2-5fda-40c1-a48c-ff84881a4d27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
In reply to this post by Monika Singhal
Hi Monika,

Thank you so much for your reply. I have tried but item is not selected.

Select sel = new Select(driver.findElement(By.id("requestreason")));
sel.selectByVisibleText("HEDIS");


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8dd4eb65-3811-4f8f-89cf-c793257eea5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Akshat Gupta
In reply to this post by PGF Bangalore English
new Select(driver.findElement(By.id("requestreason"))).selectByVisibleText("HEDIS");


Just use this.

void error will not be there.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/1d01e292-f679-4098-9ec8-34832436cbc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
Thank you Akshat .I have tried with this " new Select(driver.findElement(By.id("requestreason"))).selectByVisibleText("HEDIS"); "

No Error but item is not selected.I'm not getting what's the problem is 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/446ce1b4-f63c-4b9f-983c-203c83593b28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Akshat Gupta
In reply to this post by PGF Bangalore English
You want to click it or just want to select the expected option ?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/aa9c5006-236c-47bf-ae0a-cd7c47d84c2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
I was trying to select the option.I have attached the snapshot of output.Program executed successfully but item is not selected.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c2b13721-872f-405c-88e4-35622b4898d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Output.PNG (70K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Monika Singhal
TRY THIS:

WebElement select_element= driver.findElement(By.id("requestreason"));

select_element.findElement(By.xpath("./option[text()='Stars']")).click();


YOU CAN REPLACE IT BY ANY TEXT YOU WANT TO SELECT.


On Thursday, June 8, 2017 at 9:52:33 PM UTC+5:30, PGF Bangalore English wrote:
I was trying to select the option.I have attached the snapshot of output.Program executed successfully but item is not selected.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3d4529fb-c18b-41bd-95e7-7644c940202b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
Monika, I have tried what  you have suggested but item is not selected.I have tried several times with different options

I have attached the snapshot of output

 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d271827b-accd-4cea-a357-7b5d609d1e6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Output3.PNG (48K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Akshat Gupta
In reply to this post by PGF Bangalore English
Use value field instead of Text, it might help. You have to give value=2 for HEDIS

There is another option, you can go for index for selection.

As per your screenshot attached, your test cases are passing perfectly. Debug it once and inspect the line where you are finding element.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bfdcbc03-6cc7-4c9a-ad78-3871a747fe3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Akshat Gupta
In reply to this post by PGF Bangalore English
Hi,

if it doesn't work give the url of the website, i will see.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ca6647f0-41d9-475c-80cf-3d718a824075%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
In reply to this post by Akshat Gupta
Hi Akshat,

I have tried with the value but item is not selected.Can you check the snapshot once. 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/92be63df-bbfe-43c4-ae56-513ea04fdbbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Debug_Output.PNG (68K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Moises Siles
also could you take a look of the webelement, there are some dropdowns as input elements instead of select

On Tue, Jun 13, 2017 at 8:14 AM, Sunitha Gummadi <[hidden email]> wrote:
Hi Akshat,

I have tried with the value but item is not selected.Can you check the snapshot once. 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/92be63df-bbfe-43c4-ae56-513ea04fdbbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAN2b6KKgZLc17ub76X%2Bu-xAPu3m1afdN%3D%2BUpWHmOi2K2BE%2BWpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

Moises Siles
I mean, take a screenshot of the html

On Tue, Jun 13, 2017 at 3:04 PM, Moises Siles <[hidden email]> wrote:
also could you take a look of the webelement, there are some dropdowns as input elements instead of select

On Tue, Jun 13, 2017 at 8:14 AM, Sunitha Gummadi <[hidden email]> wrote:
Hi Akshat,

I have tried with the value but item is not selected.Can you check the snapshot once. 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/92be63df-bbfe-43c4-ae56-513ea04fdbbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAN2b6KKheqrkFA4GypyXX9u8kfv2KKOpu0Jv4Wce49PG%3DtS84g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
Hi,

Select class is used for  Drop down. 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ce8c302a-e403-41ed-9961-36e6cc599e96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dropdown-HTML.PNG (36K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Not able to select the item in t drop down list.

PGF Bangalore English
Hi,

I'm able to print the Dropdown items but i was not able to select the item .I have tried 3 methods like  "selectByVisibleText", "selectByValue"  and "selectByIndex" but no use.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/eb373afe-4430-4276-afdb-0a19c97d8330%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

DropdownList_Output.PNG (67K) Download Attachment
12