- gchandrasekaran82Regular Participant
- Posts : 33
Join date : 2011-02-16
How to import python code in to selenium
Wed Feb 16, 2011 8:57 pm
The below code which i have written in notepad and saved it as python file(.py)
When i import this file it is giving error loading file... How to solve this problem.
from selenium import selenium
import unittest, time, re
class RSRK Automation(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*chrome", "https://secure02.monilink.co.uk/")
self.selenium.start()
def test_r_s_r_k _automation(self):
sel = self.selenium
sel.open("/matml-core/login.do?XMSISDN=447824877108&MATM-GUID=16d34a25d462c6c96e")
sel.type("username", "RSRK")
sel.type("password", "s10")
sel.click("_Continue1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Payments")
sel.wait_for_page_to_load("30000")
sel.click("link=Pay Credit Card")
sel.wait_for_page_to_load("30000")
sel.click("link=Select Card")
sel.wait_for_page_to_load("30000")
sel.click("link=exact:Fuel Credit Card ************2015 Due Date: 18/09/10")
sel.wait_for_page_to_load("30000")
sel.click("link=Select Account")
sel.wait_for_page_to_load("30000")
sel.click("link=Next 10")
sel.wait_for_page_to_load("30000")
sel.click("link=Test SCB Account 11111111111 Balance: INR 62000.00")
sel.wait_for_page_to_load("30000")
sel.type("amount", "126")
sel.type("transferDate", "200211")
sel.click("_Continue1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Edit")
sel.wait_for_page_to_load("30000")
sel.type("amount", "125")
sel.type("transferDate", "190211")
sel.click("_Continue1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Confirm")
sel.wait_for_page_to_load("30000")
sel.click("link=Make Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=View and Pay Bills")
sel.wait_for_page_to_load("30000")
sel.click("_Select+bill1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=B.S.N.L, MYSORE INR 135.00 due by 27/09/10")
sel.wait_for_page_to_load("30000")
sel.click("_Select+account+or+card2_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Joint Account Created for Testing Purpose $$$$$$ 11111111112 Balance: INR 3550.00")
sel.wait_for_page_to_load("30000")
sel.type("paymentDateString", "200211")
sel.click("_Continue3_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Edit")
sel.wait_for_page_to_load("30000")
sel.type("paymentDateString", "210211")
sel.click("_Continue3_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Confirm")
sel.wait_for_page_to_load("30000")
sel.click("link=Make Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=Bill Payment")
sel.wait_for_page_to_load("30000")
sel.click("_Select+a+biller1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=B.S.N.L, INDORE 111111111111111")
sel.wait_for_page_to_load("30000")
sel.click("_Select+account+or+card2_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Loan Account Created for Testing Purpose 11111111113 Balance: INR 2500.00")
sel.wait_for_page_to_load("30000")
sel.type("amount", "250")
sel.type("paymentDateString", "190211")
sel.click("_Continue3_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Confirm")
sel.wait_for_page_to_load("30000")
sel.click("link=Make Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=View Payments History")
sel.wait_for_page_to_load("30000")
sel.click("link=AIRTEL, BANGALORE 4940760300032009 24/10/10 INR 1010.0")
sel.wait_for_page_to_load("30000")
sel.click("link=View Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=AIRTEL, BANGALORE 4940760300032009 24/10/10 INR 1010.0")
sel.wait_for_page_to_load("30000")
sel.click("link=View Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=AIRTEL, BANGALORE 22500000220 10/10/10 INR 100.0")
sel.wait_for_page_to_load("30000")
sel.click("link=Main menu")
sel.wait_for_page_to_load("30000")
sel.click("link=Logout")
sel.wait_for_page_to_load("30000")
sel.click("link=Yes")
sel.wait_for_page_to_load("30000")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
When i import this file it is giving error loading file... How to solve this problem.
from selenium import selenium
import unittest, time, re
class RSRK Automation(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*chrome", "https://secure02.monilink.co.uk/")
self.selenium.start()
def test_r_s_r_k _automation(self):
sel = self.selenium
sel.open("/matml-core/login.do?XMSISDN=447824877108&MATM-GUID=16d34a25d462c6c96e")
sel.type("username", "RSRK")
sel.type("password", "s10")
sel.click("_Continue1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Payments")
sel.wait_for_page_to_load("30000")
sel.click("link=Pay Credit Card")
sel.wait_for_page_to_load("30000")
sel.click("link=Select Card")
sel.wait_for_page_to_load("30000")
sel.click("link=exact:Fuel Credit Card ************2015 Due Date: 18/09/10")
sel.wait_for_page_to_load("30000")
sel.click("link=Select Account")
sel.wait_for_page_to_load("30000")
sel.click("link=Next 10")
sel.wait_for_page_to_load("30000")
sel.click("link=Test SCB Account 11111111111 Balance: INR 62000.00")
sel.wait_for_page_to_load("30000")
sel.type("amount", "126")
sel.type("transferDate", "200211")
sel.click("_Continue1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Edit")
sel.wait_for_page_to_load("30000")
sel.type("amount", "125")
sel.type("transferDate", "190211")
sel.click("_Continue1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Confirm")
sel.wait_for_page_to_load("30000")
sel.click("link=Make Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=View and Pay Bills")
sel.wait_for_page_to_load("30000")
sel.click("_Select+bill1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=B.S.N.L, MYSORE INR 135.00 due by 27/09/10")
sel.wait_for_page_to_load("30000")
sel.click("_Select+account+or+card2_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Joint Account Created for Testing Purpose $$$$$$ 11111111112 Balance: INR 3550.00")
sel.wait_for_page_to_load("30000")
sel.type("paymentDateString", "200211")
sel.click("_Continue3_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Edit")
sel.wait_for_page_to_load("30000")
sel.type("paymentDateString", "210211")
sel.click("_Continue3_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Confirm")
sel.wait_for_page_to_load("30000")
sel.click("link=Make Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=Bill Payment")
sel.wait_for_page_to_load("30000")
sel.click("_Select+a+biller1_button")
sel.wait_for_page_to_load("30000")
sel.click("link=B.S.N.L, INDORE 111111111111111")
sel.wait_for_page_to_load("30000")
sel.click("_Select+account+or+card2_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Loan Account Created for Testing Purpose 11111111113 Balance: INR 2500.00")
sel.wait_for_page_to_load("30000")
sel.type("amount", "250")
sel.type("paymentDateString", "190211")
sel.click("_Continue3_button")
sel.wait_for_page_to_load("30000")
sel.click("link=Confirm")
sel.wait_for_page_to_load("30000")
sel.click("link=Make Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=View Payments History")
sel.wait_for_page_to_load("30000")
sel.click("link=AIRTEL, BANGALORE 4940760300032009 24/10/10 INR 1010.0")
sel.wait_for_page_to_load("30000")
sel.click("link=View Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=AIRTEL, BANGALORE 4940760300032009 24/10/10 INR 1010.0")
sel.wait_for_page_to_load("30000")
sel.click("link=View Another Payment")
sel.wait_for_page_to_load("30000")
sel.click("link=AIRTEL, BANGALORE 22500000220 10/10/10 INR 100.0")
sel.wait_for_page_to_load("30000")
sel.click("link=Main menu")
sel.wait_for_page_to_load("30000")
sel.click("link=Logout")
sel.wait_for_page_to_load("30000")
sel.click("link=Yes")
sel.wait_for_page_to_load("30000")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
Permissions in this forum:
You cannot reply to topics in this forum