Beispiel #1
0
 def test_picture_in_yandex(self):
     driver = self.driver
     driver.implicitly_wait(3)
     logging.info(u'set wait time 3 sec')
     try:
         driver.get("https://www.yandex.ru/")
         logging.info(u'go to yandex.ru')
     except:
         logging.error(u'cannot go to yandex.ru')
     try:
         assert "Яндекс" in driver.title
         logging.info(u'it is yandex.ru')
     except:
         logging.error(u'it is not yandex.ru')
     pick_test = Page(driver)
     try:
         pick_test.click_on_pictures()
         logging.info(u'click on pictures')
     except:
         logging.error(u'cannot click on pictures')
     try:
         assert 'https://yandex.ru/images/' in driver.current_url
         logging.info(u'it is yandex/images')
     except:
         logging.error(u'it is not yandex/images')
     try:
         pick_test.click_on_first_img()
         logging.info(u'first img is found')
     except:
         logging.error(u'first img is not found')
     try:
         pick_test.check_img()
         logging.info(u'image is open')
     except:
         logging.error(u'image is not open')
     try:
         src = pick_test.get_img_src()
         logging.info(u'get argument scr')
     except:
         logging.error(u'cannot get argument scr')
     try:
         pick_test.next_image_button_click()
         logging.info(u'get next img')
     except:
         logging.error(u'cannot get next img')
     try:
         src1 = pick_test.get_img_src()
         logging.info(u'get argument src')
     except:
         logging.error(u'cannot get argument scr')
     if (src == src1):
         logging.info(u'image arnt different')
     else:
         logging.error(u'image are different')
     try:
         pick_test.previous_picture_button_click()
         logging.info(u'click on prev button')
     except:
         logging.error(u'cannot click on prev button')
     try:
         src2 = pick_test.get_img_src()
         logging.info(u'get attribute scr')
     except:
         logging.error(u'cannot get attribute scr')
     if (src1 != src2):
         logging.error(u'image are different')
     else:
         logging.error(u'image arnt different')
     assert "No results found." not in driver.page_source