how to check .doc element text through seleniumlibrary & robotframework - python-3.x

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

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

Related

Chrome Extension Newbie Question - check web page for entries, click hyperlink and refresh

I am just starting out writing my first Chrome plugin so hopefully I ask this question using the right vocabulary. Also looked for other questions that might be the same as this one and didn't find any that covered what I was looking for.
I've read the documentation on creating a Chrome Extension and have done the "Hello World" extension and see it write its output to the background console log. However, I'm not sure exactly how I would structure the extension I want to build between background and content. Any help/pointers (and examples) would be greatly appreciated.
Here's what I'd like the extension to accomplish:
Have it appear in the toolbar where other extensions appear
Have it be able to be enabled/disabled
When enabled:
Read data from the current page
If it finds certain entries "click" on the hyperlink to select them
Sleep for 5 seconds
Repeat the process
Or if there is another extension that does something similar already if you can point me to it maybe I can base my code off the same structure

How to download a text file displaying on web page

I am learning Algorithms 4th. And now I want to download a data file 1Mints.txt which is a input file for testing K-Sum algorithm. Thus, I search it on the book's website. Fortunately, I find the corresponding page but the file just display on line and I can not download it. I hope someone could help me. Thanks.
file link: https://algs4.cs.princeton.edu/14analysis/1Mints.txt
You can Download the file by below steps:
Open the Web page from which you want to extract text.
Click the “Right Click” menu.
Click the “Save as”, then in the “Filename” 1Mints.txt comes.
Then select “Save as Type” as “Text Document” and then Okay.
It will Download 1Mints.txt at the specified location.
When I found the following method to download it, I really think I am a foolish. You just right click the web page and chose save it.

Roku SceneGraph with Search Functionality

I'm creating a Roku app in SceneGraph and trying to near duplicate the search functionality I had using the old SDK. I'm stuck at only being able to display the mini keyboard. I'm trying to add buttons via buttongroup (i.e., Search, Cancel) but having two issues:
Not sure how to get the text string that's typed into the mini keyboard and store that in a variable or field so I can perform the search on it.
How to create a Search button and give it focus when user is ready to search for the string they entered.
Any help would be appreciated. Thanks.
SGDEX (Scenegraph Developer Extensions) is what you need. They have a view called "SearchView". Look it up.
Also...
RALE (Roku Advanced Layout Editor) has good search options. - I have been unable to find a decent Search sample. It would be cool if we could export the source code from RALE.
However if you haven't tried RALE. You could upload your script, then add search to it.

Microsoft Word Automated Find and Replace feature

In a Microsoft template file I downloaded from their website, whenever you type any word in place of where it says " < your company > " (for instance, if I type the word "Apple" in it's place), it automatically changes it everywhere within the entire document. So anywhere in the document that says " < your company > ", it will now all be changed to "Apple".
Does anyone know how to create that?
It seems like some pre-programmed and automated "Find & Replace" feature, but I don't know how to create it. Does it involve some external Excel file? I don't think it's a macro, because " < your company > " is replaced by text that is entered, not a pre-determined word.
This video kind of addresses what I'm trying to achieve. But it's not quite perfect because it's talking about a "find and replace" for multiple Word files, and for replacing the text with a pre-determined word (not what the user enters):
www.youtube.com/watch?v=etSoe8P7_PE
The Word file I'm referring to can be downloaded from my dropbox here:
https://www.dropbox.com/sh/b8hg0ahbx27wfij/CdlGP_bdcm
If you don't feel comfortable downloading a file from my dropbox: I downloaded this file from Microsoft's website, so if you want to download it directly from there, you can via the link below. It seems like the link won't take you directly to the file, so you just have to enter "project change" in the search bar and click enter, then download the Word 2013 "Project change authorization form (Business Blue design)" file:
http://office.microsoft.com/en-us/templates/results.aspx?qu=project%20change&queryid=13f05805-9704-404a-911b-c3cd70c3fe5c&avg=zwd#ai:TC103444179|
Thank you so much for your time and help!!
This is the code you look for :
Find and Replace using Word interop
Hope this helps.
The current version of the OP's template lives at https://templates.office.com/en-us/Services-proposal-Business-Blue-design-TM02911896
It is using content controls (forms), which are accessible under the developer tab of the ribbon. Click "Design Mode" to view the magic.

How to search a PDF in Acrobat Reader AND jump to a certain page via parameter?

We are using lucene within a web application to search in a great number of PDF documents.
The workflow is like this:
A user enters a search term
A list of search results is presented to the user.
Each search result represents one PDF document and shows the user on which page the search term was found. Each of these pages is represented as a hyperlink.
If the user now clicks on such a hyperlink, he directly jumps to that page.
But now the user has the problem that the search term isn't highlighted on the page. Therefore the user has to look on his own to find the search term on the page.
What we wanted is a way to highlight the search term on the specific page in the PDF.
The open parameters for Acrobat Reader allow for either searching a PDF document (with hit highlighting) OR jumping to a specific page. But the combination of both parameters - which we would need - doesn't work.
Does anyone have an idea how jumping to a page and highlighting a search term in a PDF document could work?
I had a look at the Acrobat SDK but don't see how we can use it (it's terribly documented).
acrobat uses a plugin to hilite terms, and requires a fdf stream to indicate the words to hilite.
See here for pointers:
support.dtsearch.com/dts0152.htm
update:
assuming you know the page# and word# on the page to hilight, here is one way to do it:
On web page:
<iframe id="acroframe" src="pdfpage/example.pdf#xml=http://example.com/hilite.aspx?hilite=8e3302ee-ff88-41ee-bdfb-9e8df87cc3ad&toolbar=1&navpanes=0&statusbar=0&view=FitH">
</iframe>
The PDF will appear in the frame, it will show the toolbar, hide the navpane & status bars and fit page to horizontal. Then it will query the web site to get the xfdf data for hilighting: http://example.com/hilite.aspx?hilite=8e3302ee-ff88-41ee-bdfb-9e8df87cc3ad
Here I used a guid key that I previously saved in the session with the hilite xfdf value.
The hilite.aspx page will return something like the following to hilite words in the document:
<XML>
<Body units=characters color=#ff00ff mode=active version=2>
<Highlight>
<loc pg=15 pos=3583 len=5>
</Highlight>
</Body>
</XML>
This will hilight 5 chars on page 15 starting at position 3583. (note: xfdf is not real "XML" despite the similarity)
Note that acrobat reader will have to have the "Enable search highlights from external highlight server" option checked in preferences.
Sorry might not be an answer, but a workaround could be to covert the PDF to html and use Lucene highlighter (similar to what Google does)
You'd have to write a snippet of Javascript to get the behavior you are looking for.

Resources