# Generated by Selenium IDE
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys


class TestDefaultSuite():
    def setup_method(self, method):
        # 如果集成到Jenkins需要无界面化，就用下面代码
        print("使用无界面方式运行测试")
        option = webdriver.ChromeOptions()
        option.add_argument("--headless")
        self.driver = webdriver.Chrome(options=option)

        # 普通启动chrome浏览器用下面代码
        # self.driver = webdriver.Chrome()
        self.vars = {}

    def teardown_method(self, method):
        self.driver.quit()

    def test_testsearch(self):
        print("打开浏览器，访问TesterHome")
        self.driver.get("https://testerhome.com/")
        self.driver.set_window_size(1200, 761)
        self.driver.find_element(By.NAME, "q").click()
        print("搜索关键词：appium")
        self.driver.find_element(By.NAME, "q").send_keys("appium")
        self.driver.find_element(By.NAME, "q").send_keys(Keys.ENTER)
