selenium robot framework -how to get element description - robotframework

I'm new on RobotFramework and have an issue as below.
Can someone help me on this?
<div id="cdk-describedby-message-41" role="tooltip">Open</div>
I would like to get "Open" from this element locator
I tried to use:
${des} Get Element Attribute //*[#id="${cdk-describedby-message-41}"] role
Log To Console ${des}
It would print out "tooltip"
Thanks a lot!

Well, first of all, it's not a description it's an element value!
Then you're using Get Element Attribute keyword. Attributes in this element are id and role, you should use Get Text keyword instead!
Here is a answer! How to get web element value and compare it with a number in Robot Framework?

I resolved my issue:
${des} Get Element Attribute //*[#id="${cdk-describedby-message-41}"] textContent

Related

Can robot framework click on plain text?

I have a need to click on plain texts a few times to activate a module.My code is
FOR ${index} IN RANGE 6
Log ${index}
Wait and Click Element text='SNAPSHOT'
END
And html block is
<div _ngcontent-lxw-c204=""><span _ngcontent-lxw-c204="">Versio: 5.8.4-SNAPSHOT</span><span _ngcontent-lxw-c204="" class="Test-version"></span><!----></div>
But always the error is cannot find the text .
From the code snippet, I would suggest doing it like this. Instead of using text attribute, I would use XPath expression.
Click Element //*[contains(text(), "SNAPSHOT")]
I don't know the keyword Wait and Click Element. Can you please provide me with more info about this keyword?

selecting specific link from ng-repeat CSS using robot framework

Webpage opens one popup, in that popup I have a list of pets. like dog, cat, fish, etc. each element is a link, and defined as below in css. but all of them have same values for all of the attributes, like div class, ng-bind, ng-click, etc. only one difference is text. I am not getting how to select a specific value using this text.
Both of the images are attached for reference. you can check the CSS code as well as the application popup.
Application popup
Css Code
Please help me out....
In the below xpath example I'm assuming that this list is uniquely referenced using the #ng-repeat attribute and with that the following reference will become a unique one: //div[#ng-repeat='category in allCategory' and text() = 'Cow/Bull']
Partial matching of the text with xpath, just a little modification to the first answer.
//div[contains(text(),'Cow/Bull') and #ng-repeat="category in allCategory"]

Robotframework . How I handle collapsible menu?

I try to use Click Element id=elementid in Robotframework.I have Selenium2 Library.I have a Menu collapsible.See little arrow on Entity 1 on first print screen.I try to identify the element id.I cannot see element id when I inspect this.I see only jotid that I do not think is the same.So, I am not able to use click element in order to expand my menu.I appreciate anyone's help as I am still learner.Please see also the images of a) Code, Menu, Inspected Element
You can also find it using xpath, so:
Click Element | //li[#wuid="gx:309..."]
jotid is not id, so you cannot locate it by id.
You could try keyword:
Click Link ENTITY 1 -Introduction
or find it by css:
Click element css=a[jotid='wuid:gx:4286...<the rest of it>']

Simple HTML Dom get href that begins with

I am using Simple HTML Dom to extract information from a remote source. I would like to get all href links that contain a particular piece of text (not all on a page). I have tried
->find('a[href*="/place"]')
and
->find('a[href="/place"*]')
and
->find('a[href="/place*"]')
but this returns empty results.
The href I am trying to get must begin with the text "/place".
Any suggestions?
Thanks
Match elements that have the specified attribute and it starts with a certain value, use [attribute^=value].
->find('a[href^="/place"]')
Ref: http://simplehtmldom.sourceforge.net/manual.htm#frag_find_attr
I do not now this app, however did you try using the asterisk like so ?
>find('a[href="/place*"]')

"value error: Element locator did not match any element." while trying to locate a element

I am using Robot Framework with Selenium2Library for website tests automation. My HTML Value is
<select class="autoWidth m![Element Locator Error][1]inWidth" id="ctl00_ResultPanePlaceHolder_ctl00_ctl02_ctl01_contentContainer_ddlLanguage" name="ctl00$ResultPanePlaceHolder$ctl00$ctl02$ctl01$contentContainer$ddlLanguage">
<option value=![enter image description here][2]"1118">አማርኛ ‎(ኢትዮጵያ)‎</option>
I am using cmd
Click Element id=ctl00_ResultPanePlaceHolder_ctl00_ctl02_ctl01_contentContainer_ddlLanguage
I am getting
value error: Element locator did not match any element.
How to fix this issue.
Most likely your element is inside an iframe. Look through the html to see if you see <iframe ...> before the element you are trying to click. If so, you first need to use Select Frame before trying to click on the element.
You should need to use id= as ID is one of the default attributes it looks for. Is it possible to see some more of the html code surrounding the element you are after?

Resources