-1

I'm trying to locate and check a text inside a .doc element which is opened on a new tab through a link.

So let's suppose I click a link which opens a new tab, this tab is a .doc which has a title saying "Welcome".

How can I let my robotframework check that welcome text?

ND. I've tried with the standard keywords like "Element text should be", "Page should contain" etc. and it's not working.

Thanks

Andrea
  • 49
  • 8
  • Hello @Andrea G., welcome to StackOverflow... Share the more information like your code of try and the source of the html that you are trying to automate so that it will be easy to answer your question. For now, I don't know about the Robot Framework but you can try to use `window handles` to get the count of the windows then you can switch to it to perform operations on it... – Ali Feb 19 '19 at 13:37
  • Hi @AliCSE I already switched to the window through "Select Window NEW" keyword. Problem is that .doc file is not a webpage meaning robotframework doesn't recognize elements inside it. By the way I'll try to figure out if I can share more useful informations to let people understand the issue easily. – Andrea Feb 19 '19 at 13:41
  • @AndreaG. as you've written yourself the _.doc file is not a webpage_ so the mentioned selenium keywords (not robotframework) are not able to operate on that file. Maybe you should split your test case in two parts: Download the doc file to a local directory and analyse it using some other RF library or python module. However, I don't know of any RF library that is capable of doing that. – Würgspaß Feb 19 '19 at 14:11

1 Answers1

0

There is nothing built into robot framework to do this. Fortunately, robot framework is very extensible so you can write a custom keyword to do the work. This keyword will need to open the file and do the search, and then return the results to the test.

There is a question on this site titled Reading doc file with python which might be able to help with reading the file.

The robot framework user guide has an extensive section on writing custom keywords. See Creating test libraries

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685