By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,486 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,486 IT Pros & Developers. It's quick & easy.

cPAMIE/Python String and Date Comparisons

P: n/a
I am new to Python, and PAMIE has been a very useful tool for my
website functionality testing.
I was wondering if anyone knows how to do the following testcases with
either PAMIE or Python.
1. Load a page
Verify that the string 'News for MSFT' exists on the page.
Verify that the date '7 November 2005' is equal to today's date.

Your help would be greatly appreciated and here is what I have so far

import cPAMIE

ie.Navigate ('')


Nov 7 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Here's an example:

import cPAMIE
import time
from time import sleep
search_txt = 'MSNBC Pairs Chung, Povich'
date_txt = '8 November 2005'

date_tuple = time.strptime(date_txt,'%d %B %Y')
today_tuple = time.localtime()

if date_tuple[:3] == today_tuple[:3]:
print date_txt + ' is today\'s date.'
print date_txt + ' is not today\'s date.'

sleep(1) # let the browser start loading...

while ie.getIE().Busy: # wait for the page to fully load
sleep(1) # extra pauses tend to help.

# Get ASCII string of page data without HTML tags.
page_txt =
str((ie.getIE().Document.body.innerText).encode('a scii','ignore'))

if search_txt in page_txt:
print '\"' + search_txt + '\"' + ' found on page.'
print '\"' + search_txt + '\"' + ' not found on page.'



Nov 9 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.