Esempio n. 1
0
def fetch_court_schedules_for_today():
    schedules = []
    today = datetime.today()
    day_of_month = str(today.day)
    now = datetime.now(NY_TIMEZONE)
    cur_step = 1
    total_steps = len(court_name_to_url_map.keys())
    try:
        for court_name in court_name_to_url_map.keys():
            schedule_fetcher = DailyScheduleFetcher(driver, now)
            print('Step ' + str(cur_step) + ' of ' + str(total_steps) +
                  ':\nFetching ' + court_name.lower() + ' schedule...')
            court_bookings = schedule_fetcher.fetch(
                court_name_to_url_map[court_name], day_of_month)
            schedules.append(CourtSchedule(court_name, court_bookings))
            cur_step += 1
            clear()
    except:
        print('An issue occurred while fetching a schedule')
    finally:
        driver.quit()
    return schedules
Esempio n. 2
0
 def test_Teardown(self):
     driver.close()
     driver.quit()
     print("Test completed")
rgb = password.value_of_css_property('background-color')
hex = Color.from_string(rgb).hex
print("Password input color is: ", hex)

driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]').click()
time.sleep(2)

form_message = driver.find_element_by_css_selector("form-message")
print("Alerts are displayed: ", form_message.is_displayed())

print ("\n Email alert and input color:")

emailAlert = driver.find_element(By.CSS_SELECTOR, 'form-message[content = "Wpisz poprawny adres e-mail."]')
print("Email alert is displayed: ", emailAlert.is_displayed())
# driver.getCssValue(email, 'background-color')
rgb = email.value_of_css_property('background-color')
hex = Color.from_string(rgb).hex
print("Color of email input changed to: ", hex)


print ("\n Password alert and input color:")

passAlert = driver.find_element(By.CSS_SELECTOR, 'form-message[content = "Wpisz hasło."]')
print("Password alert is displayed: ", passAlert.is_displayed())
rgb = password.value_of_css_property('background-color')
hex = Color.from_string(rgb).hex
print("Color of password input changed to: ", hex)

# driver.close()
driver.quit()
Esempio n. 4
0

# 调整浏览器窗口大小
driver.maximize_window() # 窗口最大化一般用这个
# driver.set_window_size(1600,900) # 括号里面跟分辨率

# 打开网址
driver.get("http://api.yansl.com:8080/swagger-ui.html#!")
sleep(2)
driver.get("https://www.baidu.com/")
sleep(2)
driver.get("https://www.taobao.com/")


# 后退
driver.back()
sleep(2)

# 前进
driver.forward()
sleep(2)

# 刷新
driver.refresh()
sleep(2)

# 关闭浏览器
sleep(3)
# driver.close()# 只关浏览器不退出进程
driver.quit()# 推荐用这个机关掉又结束进程