Robotframework: AngularJs: unable to select a value from dropdown

1,023 views
Skip to first unread message

Nagendra

unread,
Apr 27, 2016, 1:39:24 AM4/27/16
to robotframework-users
Hi All,

I'm using robotframework for an angularjs application.

I'm trying to select a value from the dropdown and I am unable to. Could any one please help?

I've this in dropdown and trying to select "Victoria" from the list.

Below is the html code



I tried below, however it clicks on the state dropdown, however it doesn't select the value that I am passing. Could anyone of you please help?

****Variables***
${Residential_Address_State}    dom = document.getElementById('PD_Me_AddrRes').getElementsByTagName('span')[3]

****Test Cases***
click element  ${Residential_Address_State}
select from list by value    ${Residential_Address_State}  Victoria


I tried using by index, by label as well, however it didn't help me.

Thanks,
Nagendra

J Wipf

unread,
Apr 27, 2016, 7:15:00 AM4/27/16
to robotframework-users
I don't know of a location strategy that uses a dom format. Which library are you using? I assume Selenium2Library; you may want to look into Extended Selenium2Library. ES2L supports angularJS locators [1] such as model/binding/etc.

As far as the `dom = ..` portion itself, I don't actually see an ID of 'PD_Me_AddrRes' in the second screen capture. That may be part of the problem.

Tatu Aalto

unread,
Apr 27, 2016, 8:27:38 AM4/27/16
to J Wipf, robotframework-users

Ugh

There is also extension on top of the Selenium2Library, AngularJSLibrary[1], which provides a better support for AngularJS applications.

For next time, tell which library you are using. Also if you get an error, please post the full stack trace also. Stack trace is visible when trace loglevel is used from Robot Framework.

-Tatu

[1] https://github.com/Selenium2Library/robotframework-angularjs

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Nagendra

unread,
Apr 27, 2016, 9:43:46 PM4/27/16
to robotframework-users
HI,

I am using extended selenium 2 library (sorry, going forward, I will mention the library which I am using as well)
Library  ExtendedSelenium2Library

when i do find the element and i click on copy xpath, i get the below

//*[@id="PD_Me_AddrRes"]/div[2]/div/div/div[1]/div/div[5]/div/div

The above one is for main element.

If i select (victoria) for example in dropdown and try to get copy xpath, then I get the below

//*[@id="PD_Me_AddrRes"]/div[2]/div/div/div[1]/div/div[5]/div/ul/li[8]

Nagendra

unread,
Apr 27, 2016, 9:43:59 PM4/27/16
to robotframework-users
Thanks Tatu..i will try this...


On Wednesday, 27 April 2016 21:15:00 UTC+10, J Wipf wrote:

Nagaraj Hebbar

unread,
Apr 28, 2016, 7:13:42 AM4/28/16
to robotframework-users
Hello,
          Try with the css selectors below
           ul[ng-class="{open: open, closed: !open}"]>li:nth-child(8)



Regards
Nagaraj

Nagendra Tanguturi

unread,
Apr 28, 2016, 11:07:38 PM4/28/16
to nagaraja...@gmail.com, robotframework-users
thanks nagaraj.'

I tried this ${ACT_ResidentialAddress} dom = document.getElementById('PD_Me_AddrRes').getElementsByTagName('li')[1]
and click element ${ACT_ResidentialAddress}

and it worked;;;thanks a lot for taking sometime to reply....

--
You received this message because you are subscribed to a topic in the Google Groups "robotframework-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robotframework-users/1M0ncyQJf_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.



--
Thanks & Regards,
Nagendra Tanguturi

Prashant

unread,
May 4, 2016, 5:45:07 PM5/4/16
to robotframework-users, nagaraja...@gmail.com
Hi i am also facing the similar issue, 

I have the ul list, which contains list of items

Is there any way where we can get the list elements or get all xpath's of the items. so I can run a loop and do my action?  

please suggest. 
Reply all
Reply to author
Forward
0 new messages