I'm having some trouble figuring out how to take out what is not necessary in a selenium strip and package it in such a way that I can call it from another script.. I am having trouble understanding what is going on with this, as I don't get where the unit testint parts are coming from... ideally if I could just separate this into a function that I could call that would be idea, thanks for any advice.
(AND, yes i do need selenium, I kindly ask that you please don't suggest alternatives as I am going to be using selenium for a lot of things so I need to figure this out)
This is just a basic demo script:
from selenium import selenium
import unittest
class TestGoogle(unittest.TestCase):
def setUp(self):
self.selenium = selenium("localhost", \
4444, "*firefox", "http://www.bing.com")
self.selenium.start()
def test_google(self):
sel = self.selenium
sel.open("http://www.google.com/webhp")
sel.type("q", "hello world")
sel.click("btnG")
sel.wait_for_page_to_load(5000)
self.assertEqual("hello world - Google Search", sel.get_title())
def tearDown(self):
self.selenium.stop()
if __name__ == "__main__":
unittest.main()