Python, Unicode, Excel and Web Tesing

calfdog at yahoo.com calfdog at yahoo.com
Fri Nov 7 05:29:29 CET 2003


Hello,

I have been doing some experimenting with Automating Internet Explorer
for testing.

I would like to read from Excel and use the data to set the values of
my text boxes on my web forms.
I have been running into problems with Unicode as I can see others
have too.
I have seemed to find a simple solution when printing

Since Excel seems to give back this format  (u'Test1',)

If I use this code I get
(u'Test1',)
(u'Test2',)
(u'Test3',)
(u'Test4',)
(u'Test5',)


##########################################
import win32com.client.dynamic

x = win32com.client.dynamic.Dispatch("Excel.Application")
x.Visible=0
x.Workbooks.Open("C:\\Python23\\Lib\\site-packages\\test.xls")
val = x.Range("A2:A20").Value
for i in val:
    print i   #Prints the unicode charaters

##########################################



If I use the code below  it works fine.
Test1
Test2
Test3
Test4
Test5

##########################################
import win32com.client.dynamic

x = win32com.client.dynamic.Dispatch("Excel.Application")
x.Visible=0
x.Workbooks.Open("C:\\Python23\\Lib\\site-packages\\test.xls")
val = x.Range("A2:A20").Value
for i in val:
    print i [-1]  #Prints without the unicode charaters

##########################################

Does anyone esle ot there have any experience in Automating IE in
Python and using Excel Data?
I am new Python programming but  I have managed to write several
functions for Automation I.E.
for setting text values, setting listboxes, links, Clicking buttons
ect. that are working fine.

I am working on porting another tool SAM (written in Perl)
http://samie.sourceforge.net to Python

I would like to share the info on this with other who might have 
Automated Internet Explorer with Python.

Thanks
R.




More information about the Python-list mailing list