Update example tests

This commit is contained in:
Michael Mintz 2019-02-15 02:30:36 -05:00
parent 1b935734f0
commit fcbb9498af
3 changed files with 10 additions and 10 deletions

View File

@ -4,19 +4,19 @@ from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open('https://xkcd.com/353/') # Navigate to the web page
self.open("https://xkcd.com/353/") # Navigate browser to page
self.assert_element('img[alt="Python"]') # Assert element on page
self.click('a[rel="license"]') # Click element on page
self.assert_text('free to copy', 'div center') # Assert text on page
self.assert_text("free to copy", "div center") # Assert text in area
self.open("https://xkcd.com/1481/")
title = self.get_attribute("#comic img", "title") # Get an attribute
self.assert_true("86,400 seconds per day" in title)
self.click('link=Blag') # Click on link
self.assert_text('The blag of the webcomic', 'h2')
self.update_text('input#s', 'Robots!\n') # Type text
self.assert_text('Hooray robots!', '#content')
self.open('https://xkcd.com/1319/')
self.assert_text('Automation', 'div#ctitle')
self.click("link=Blag") # Click on link
self.assert_text("The blag of the webcomic", "h2")
self.update_text("input#s", "Robots!\n") # Type text
self.assert_text("Hooray robots!", "#content")
self.open("https://xkcd.com/1319/")
self.assert_exact_text("Automation", "#ctitle")
####

View File

@ -16,4 +16,4 @@ class MyTestClass(BaseCase):
self.update_text('input#s', 'Robots!\n')
self.assert_text('Hooray robots!', '#content')
self.open('http://xkcd.com/1319/')
self.assert_text('Automation', 'div#ctitle')
self.assert_exact_text('Automation', '#ctitle')

View File

@ -93,7 +93,7 @@ def main():
data.append(" self.update_text('input#s', 'Robots!\\n')")
data.append(" self.assert_text('Hooray robots!', '#content')")
data.append(" self.open('https://xkcd.com/1319/')")
data.append(" self.assert_text('Automation', 'div#ctitle')")
data.append(" self.assert_exact_text('Automation', '#ctitle')")
data.append("")
file_path = "%s/%s" % (dir_name, "my_first_test.py")
file = codecs.open(file_path, "w+", "utf-8")