Copy a Text from a DOJO Table with RobotFrameWork,Selenium

467 views
Skip to first unread message

Balázs Heiter

unread,
Nov 13, 2015, 3:54:44 PM11/13/15
to robotframework-users
Hi!
I want to copy a text (a date) from a DOJO table, after that, I want to paste to a Text Field (on the same page)
My problem is that i cant right click to the table and inspect the element, so I have to click the border of the table where i can inspect, than i go down to the right place where the date is.
But there isn't a unique ID for that cell.

I tried a several things, like  Get Text    xpath=//td[@class='dojoxGridCell'][2]
                                                         driver.FindElement(By.CssSelector("div > dojoxGridRow:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)")
Neither worked for me.

Any idea?

Screenshots attached.

Thanks!

Best regards.
Balázs Heiter
wproblem.jpg
wproblem2.jpg

Hélio Guilherme

unread,
Nov 13, 2015, 5:45:15 PM11/13/15
to heiter....@gmail.com, robotframework-users
Looks like an id at table element would help (I would try for developers to add one).

From the documentation, we know that Get Table Cell uses a table locator by id.

How about using a full xpath expression to locate the table and its td? You could use a tool like firepath in Firefox to test the xpath.

See if something like this would work:
Get Text    xpath=//div/div/div/div/div/div/div[@id='dojox_grid_View_1']/div/div/div/div/table/tbody/tr/td[@idx='1']


--
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 http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Balázs Heiter

unread,
Nov 17, 2015, 11:29:32 AM11/17/15
to robotframework-users, heiter....@gmail.com
Hi!
I installed firepath, and it says my xpath is:     xpath=//div[@id='dojox_grid__View_1']/div/div/div/div[1]/table/tbody/tr/td[2]
I used Get Text.
and its seems its working, but in the result I only see the start and the end time of the execution if i'm correct (screenshot added)
So now, I think, I should try to paste the text what I got, to the text box what I mentioned.


Is there any idea how to do this, because I didn't find any Key Words which are paste a Text. Correct me, if I'm wrong.

Thanks!

best regards.

Balázs Heiter
WProblem3.JPG

Hélio Guilherme

unread,
Nov 17, 2015, 11:57:24 AM11/17/15
to robotframework-users
Good that you are locating the element.

Get Text returns a value, did you assigned it to a variable?

For setting values to text fields, you have Input Text, and Press Key.

See if they are enough for your needs.

--

Hélio Guilherme

unread,
Nov 17, 2015, 12:45:51 PM11/17/15
to robotframework-users
Replying back to the users list.

On Tue, Nov 17, 2015 at 5:13 PM, Balázs Heiter ... wrote:
everything is working really fine for now!
${DateString}    Get Text    xpath=//div/div/div/div/div/div/div[@id='dojox_grid__View_1']/div/div/div/div[1]/table/tbody/tr/td[2]
Input Text    xpath=.//*[@id='startDate']    ${DateString}

With this, its just do what must be done.
My next "big" problem is i want this Date increase with 5 minutes and than decrease with 5 minutes.
The Date looks like this:  '2015-11-17T16:27:46.707Z'
I want to get this: '2015-11-17T16:32:46.707Z'  and this: '2015-11-17T16:22:46.707Z'

I tried this: ${DateString+5}    Evaluate    ${DateString}[${DateString}.rfind(':')+5:]   But it says failed: SyntaxError: invalid syntax (<string>, line 1)

any idea?

Yes!
RTFM ;)

See the DateTime library, all docs are at: http://robotframework.org/robotframework/#standard-libraries

Note: Don't be offended by my RTFM. Please consider my own adaptations of the abbreviation:
Read The Friendly Manual
Read The Finest Manual
Read The Functional Manual
Read The Features Manual 

thanks

best regards.
Balázs Heiter

 

Reply all
Reply to author
Forward
0 new messages