Closed spooning closed 9 years ago
Originally submitted to Google Code by @yanne on 30 Jan 2009
It seems that the failure happens, because 'Create File' does not take encoding argument.
To verify this, can you run the attached script and report the result it prints.
Somewhat unrelated to the actual bug, is there a reason you want to write the contents to a file in the first place? Could there be some other way to achieve what you are trying to do?
Originally submitted to Google Code by claes.piper on 4 Feb 2009
I ran the selftest like C:> python selftest.py > selftest.txt
Originally submitted to Google Code by @yanne on 4 Feb 2009
Based on this, it really seems that the issue is solely with the Create File keyword not taking the encoding into account. The text returned from SeleniumLibrary seems to be proper unicode. This issue should disappear when https://code.google.com/p/robotframework/issues/detail?id=217 is fixed. If not, can be reopened
What steps will reproduce the problem? 1) Get source from web page 2) Save source to file 3) Get file 4) Compare saved file to source
Step 3 fails.
Example Test case: Compare saved page to current page Open browser http://www.google.com *firefox ${currentPage}= Get Source Create File ${TEMPDIR}${/}google-page1.html ${currentPage} ${savedPage}= Get File ${TEMPDIR}${/}google-page1.html UTF-8 Should Be Equal as Strings ${savedPage} ${currentPage} Close Browser
What is the expected output? What do you see instead? Expected: That the Get File command gets the file. Error: UnicodeError: utf-8 decoding error: invalid data
Error message from the log
KEYWORD: ${savedPage} = OperatingSystem.Get File ${TEMPDIR}${/}google-page1.html, UTF-8 Documentation: Returns the contents of a specified file. Start / End / Elapsed: 20090126 16:58:42.101 / 20090126 16:58:42.148 / 00:00:00.047 16:58:42.124 INFO Getting file 'C:\Users\CLAPIP~1.OME\AppData\Local\Temp\google-page1.html' 16:58:42.148 FAIL UnicodeError: utf-8 decoding error: invalid data
What version of the product are you using? On what operating system? Robot Framwork 2.0.4 SeleniumLibrary 2.1.1 Python 2.6.1 Running on Windows Vista Ultimate
Please provide any additional information below. Se diskussion: http://groups.google.com/group/robotframework-users/browse_thread/thread/6cdae3b5f7e5bd30#