-1

I have combo box with applications e.g Play, Go, etc. When i click to this app I moved to specific app name page. What I want to is to write a code to checking when I click for application Play I am moved to specific page with this application. I want to use robot framework for this also I want to assert the application and the page are the same.

What I have already:

[Documentation]         checking search result
click element                       ${searchfield_css}
click element                       ${inside_searchfield}
input text                          ${appFilter_id}                        
click element                       ${Play}                      ${string}
wait until element contains         ${app_details_title}              Play

But this code is selecting only one app and comparing it to one site. I want to create a generic code for this case.

The worst thing for me is to find which container holds all applications. I marked applications. HTML Code

So correct me when I'm wrong:

  1. I need to have a locator for the whole list of all application list (html container)
  2. Then I want to check inside this container is my selected application is there if yes, after click it I want to assert the name of app with the title of the page where I was moved (suppose to be the same)
A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
ranger
  • 637
  • 2
  • 9
  • 18
  • I'm not the one who down-voted you, but maybe I can explain why. It's not very clear what you're asking (possibly due to translation), your code is not "a minimum, complete, and verifiable example", and just reading your question, you seem to be looking for someone to write code for you, which is not the purpose of this site. – Brandon Olson Dec 08 '17 at 23:48
  • \my question is how to do a loop inside the html container with all application witch I need to check? – ranger Dec 11 '17 at 08:39
  • I already found this container and store it as a variable but I dont know nothing about loop..in Robot Framework – ranger Dec 11 '17 at 08:41

1 Answers1

0

Contrary to many other approaches, when dealing with WebElements in Robot Framework we do not first pick the parent and then cycle through it's children. We typically create a list of the children directly using common css (mat-list-item) or xpath (//*[@role="listitem"]) characteristics using Get Webelements. (Although I suspect that the value you really want is hidden in the image.)

When you have your list of web elements, looping through them is not difficult. In this Stack Overflow answer this example is found using the above Get Webelements keyword:

@{elems}    Get Webelements    some locator
:FOR    ${elem}    IN    @{elems}
\    ${text}    Get Text    ${elem}

If you're comfortable with Python then it is possible to pick the parent and run through it's children. In this Stack Overflow answer this approach is explained in more detail. This could be converted into a custom Robot Framework keyword. See the Robot Framework User guide on Creating test libraries for more details.

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43