Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Attempting to drop down value using Selenium IDE user extension

View previous topic View next topic Go down

Attempting to drop down value using Selenium IDE user extension

Post by Sir Barnabas on Mon Jun 03, 2013 10:41 pm

Hi,

Selenium newbie alert.

I'm trying to set a drop down value using a javascript user extension for Selenium IDE.

Everything works fine up until passing the value back where I was trying to use this;

Code:
this.browserbot.selectOption(element, var);

This doesn't seem to do anything though - it doesn't fail, just doesn't select the value.

Any ideas gratefully appreciated.

Sir Barnabas

Posts : 3
Join date : 2013-06-03

Back to top Go down

Re: Attempting to drop down value using Selenium IDE user extension

Post by tarun3kumar on Tue Jun 04, 2013 10:45 am

You can use built-in select method.
Here is the description copied from Selenium IDE -

select(selectLocator, optionLocator)
Arguments:

selectLocator - an element locator identifying a drop-down menu
optionLocator - an option locator (a label by default)

Select an option from a drop-down using an option locator.

Option locators provide different ways of specifying options of an HTML Select element (e.g. for selecting a specific option, or for asserting that the selected option satisfies a specification). There are several forms of Select Option Locator.

label=labelPattern: matches options based on their labels, i.e. the visible text. (This is the default.)
label=regexp:^[Oo]ther
value=valuePattern: matches options based on their values.
value=other
id=id: matches options based on their ids.
id=option1
index=index: matches an option based on its index (offset from zero).
index=2

If no option locator prefix is provided, the default behaviour is to match on label.

_________________
Thanks
Tarun K
Free Selenium Training

tarun3kumar
Master
Master

Posts : 186
Join date : 2012-02-14

http://seleniumtests.com

Back to top Go down

Re: Attempting to drop down value using Selenium IDE user extension

Post by Sir Barnabas on Tue Jun 04, 2013 4:22 pm

Hi,

thanks for the info, however I am still struggling to get this to work.

In brief, I am trying to automate a password screen whereby the user is requested to enter 3 characters e.g. 1st, 2nd & 3rd selected at random from their password and the characters are selected from a drop down list.

For testing purposes, the password is always the same but the characters requested change on each login.

I've created a user extension to try and do this, and everything is fine up until actually selecting the value in the drop-down which just I just can't seeem to get it to do Crying or Very sad

I've posted the code below if that helps;

Code:
Selenium.prototype.doSetMPCharOne = function(locator) {

var element = this.page().findElement(locator);

/* Determines which character is being requested
var position = element.title.charAt(10);

var char = " ";

switch(position)

    {
    case "1":
      char="p"; 
    break;
    etc..., etc...
    };

  this.browserbot.select(element, char);

};

Sir Barnabas

Posts : 3
Join date : 2013-06-03

Back to top Go down

Re: Attempting to drop down value using Selenium IDE user extension

Post by tarun3kumar on Wed Jun 05, 2013 1:19 pm

This feature seems a little weird.
It seem it is an auto-suggest list, if it is then I would suggest using "sendKeys"
and then clicking on the element which appears in auto suggest list.

_________________
Thanks
Tarun K
Free Selenium Training

tarun3kumar
Master
Master

Posts : 186
Join date : 2012-02-14

http://seleniumtests.com

Back to top Go down

Re: Attempting to drop down value using Selenium IDE user extension

Post by Sir Barnabas on Wed Jun 05, 2013 11:56 pm

Just could not get this to work, but got round it in the end by putting the relevant character in storedVar and then using the standard select command in the IDE with the storedVar as the value.

I'm sure there's probably a better way of doing it but this seems to have done the trick for now.

Thanks for your suggestions all the same.

Sir Barnabas

Posts : 3
Join date : 2013-06-03

Back to top Go down

Re: Attempting to drop down value using Selenium IDE user extension

Post by Sponsored content Today at 3:24 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum