基于 SELENIUM 的自动化测试架构(25)
发表于:2017-04-11来源:gitbook作者:凌俣Linty?点击数:
标签:selenium
None base_url = None def setUp (self) : self.base_driver = webdriver.Firefox() self.base_url = http://demo.ranzhi.org/ def tearDown (self) : self.base_driver.quit() def test_01_change_language (self)
None
base_url =
None
def setUp(self):
self.base_driver = webdriver.Firefox()
self.base_url =
"http://demo.ranzhi.org/"
def tearDown(self):
self.base_driver.quit()
def test_01_change_language(self):
driver = self.base_driver
driver.get(self.base_url)
sleep(
2)
driver.find_element_by_css_selector(
"#langs > button").click()
sleep(
1)
driver.find_element_by_css_selector(
"#langs > ul > li:nth-child(3) > a").click()
sleep(
2)
actual_lang = driver.find_element_by_css_selector(
"#langs > button").text
expected_lang =
"English"
原文转自:http://gitbook.cn/books/58e54b57cfcd6fa52dcef1d2/index.html