当前位置: 首页>>代码示例>>Python>>正文


Python WebDriver.maximize_window方法代码示例

本文整理汇总了Python中selenium.webdriver.firefox.webdriver.WebDriver.maximize_window方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriver.maximize_window方法的具体用法?Python WebDriver.maximize_window怎么用?Python WebDriver.maximize_window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.firefox.webdriver.WebDriver的用法示例。


在下文中一共展示了WebDriver.maximize_window方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_company

# 需要导入模块: from selenium.webdriver.firefox.webdriver import WebDriver [as 别名]
# 或者: from selenium.webdriver.firefox.webdriver.WebDriver import maximize_window [as 别名]
class create_company(unittest.TestCase):
    def setUp(self):
        self.wd = WebDriver()
        self.wd.maximize_window()
        self.wd.implicitly_wait(60)

    def test_create_company(self):
        wd = self.wd
        wd.get("https://qa.espresa.com")
        wd.find_element_by_id("public_site_login").click()
        wd.find_element_by_id("login_login").click()
        wd.find_element_by_id("login_login").clear()
        wd.find_element_by_id("login_login").send_keys("[email protected]")
        wd.find_element_by_id("login_password").click()
        wd.find_element_by_id("login_password").clear()
        wd.find_element_by_id("login_password").send_keys("12345678")
        wd.find_element_by_id("login_submit").click()

        # [0] - need to refer to any (1-st) element in the array to call function click()
        wd.find_elements_by_xpath("//a[contains(text(), 'Companies')]")[0].click()
        # add CAD
        WebDriverWait(wd, 10).until(
            EC.visibility_of_element_located((By.XPATH, "//button[contains(text(), 'ADD NEW')]")))
        WebDriverWait(wd, 10).until(EC.invisibility_of_element_located((By.CSS_SELECTOR, "div.popup-loader")))
        wd.find_elements_by_xpath("//button[contains(text(), 'ADD NEW')]")[0].click()
        wd.find_element_by_id('inputCompanyName').send_keys('Test Company 18')
        wd.find_element_by_id("inputFirstName").click()
        wd.find_element_by_id("inputFirstName").clear()
        wd.find_element_by_id("inputFirstName").send_keys("Company First Name 18")
        wd.find_element_by_id("inputLastName").click()
        wd.find_element_by_id("inputLastName").clear()
        wd.find_element_by_id("inputLastName").send_keys("Company Last Name 18")
        wd.find_element_by_id("inputLogin").click()
        wd.find_element_by_id("inputLogin").clear()
        wd.find_element_by_id("inputLogin").send_keys("[email protected]")
        wd.find_element_by_id("inputPhone").click()
        wd.find_element_by_id("inputPhone").clear()
        wd.find_element_by_id("inputPhone").send_keys("12345678")
        wd.find_element_by_id("inputFax").click()
        wd.find_element_by_id("inputFax").clear()
        wd.find_element_by_id("inputFax").send_keys("12345678")
        wd.find_element_by_xpath("//div[@class='form-horizontal']//span[.='+ add address']").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[1]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[1]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[1]/div[2]/input").send_keys("San Francisco")
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[2]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[2]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[2]/div[2]/input").send_keys("San Francisco")
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[4]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[4]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[4]/div[2]/input").send_keys("12345")
        wd.find_element_by_xpath("//div[@class='modal-content']//button[.='ADD']").click()
        self.wd.implicitly_wait(200)
        wd.find_element_by_id('inputSite').send_keys('www.test.com')
        wd.find_element_by_id('inputDescription').send_keys('test')
        wd.find_element_by_id("inputPoints").send_keys("1000")
        wd.find_element_by_xpath("//div[@class='nav-bar-button']//button[.='SAVE & EXIT']").click()

    def tearDown(self):
        print('OK')
开发者ID:oostapenko84,项目名称:python_training,代码行数:62,代码来源:test_create_company.py

示例2: init_browser_driver

# 需要导入模块: from selenium.webdriver.firefox.webdriver import WebDriver [as 别名]
# 或者: from selenium.webdriver.firefox.webdriver.WebDriver import maximize_window [as 别名]
 def init_browser_driver(self):
     try:
         driver = WebDriver()
         driver.implicitly_wait(30)
         driver.maximize_window()
         self.driver = driver
     except Exception:
         raise BaseException("open firefox occur error")
     return driver
开发者ID:zhchen6688,项目名称:test02,代码行数:11,代码来源:initDriver.py

示例3: WebObject

# 需要导入模块: from selenium.webdriver.firefox.webdriver import WebDriver [as 别名]
# 或者: from selenium.webdriver.firefox.webdriver.WebDriver import maximize_window [as 别名]
class WebObject(StaticLiveServerTestCase):
    """Base class for page objects."""

    @classmethod
    def setUpClass(self):
        super(WebObject, self).setUpClass()
        self.driver = WebDriver()
        self.driver.set_window_size(1024, 768)
        self.driver.maximize_window()
        self.driver.implicitly_wait(15)

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
        super(WebObject, self).tearDownClass()

    def create_login_session(self, username):
        session_cookie = create_session_for_given_user(username)
        self.driver.get(self.live_server_url)
        self.driver.add_cookie(session_cookie)
开发者ID:rakshitajain5,项目名称:python-aasemble.django,代码行数:22,代码来源:basewebobject.py

示例4: create_vendor

# 需要导入模块: from selenium.webdriver.firefox.webdriver import WebDriver [as 别名]
# 或者: from selenium.webdriver.firefox.webdriver.WebDriver import maximize_window [as 别名]
class create_vendor(unittest.TestCase):
    def setUp(self):
        self.wd = WebDriver()
        self.wd.maximize_window()
        self.wd.implicitly_wait(60)

    def test_create_vendor(self):
        wd = self.wd
        wd.get("https://qa.espresa.com")
        wd.find_element_by_id("public_site_login").click()
        wd.find_element_by_id("login_login").click()
        wd.find_element_by_id("login_login").clear()
        wd.find_element_by_id("login_login").send_keys("[email protected]")
        wd.find_element_by_id("login_password").click()
        wd.find_element_by_id("login_password").clear()
        wd.find_element_by_id("login_password").send_keys("12345678")
        wd.find_element_by_id("login_submit").click()

        # [0] - need to refer to any (1-st) element in the array to call function click()
        wd.find_elements_by_xpath("//a[contains(text(), 'Vendors')]")[0].click()
        # add VAD
        WebDriverWait(wd, 10).until(
            EC.visibility_of_element_located((By.XPATH, "//button[contains(text(), 'ADD NEW')]")))
        WebDriverWait(wd, 10).until(EC.invisibility_of_element_located((By.CSS_SELECTOR, "div.popup-loader")))
        wd.find_elements_by_xpath("//button[contains(text(), 'ADD NEW')]")[0].click()
        wd.find_element_by_id('inputCompanyName').send_keys('Test Company 29')
        wd.find_element_by_id('inputPhone').send_keys('12345')
        # add Location (Address)
        wd.find_element_by_xpath("//div[@class='form-horizontal']//span[.='+ add address']").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[1]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[1]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[1]/div[2]/input").send_keys("San Francisco")
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[2]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[2]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[2]/div[2]/input").send_keys("San Francisco")
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[4]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[4]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='modal-body']/div/div[4]/div[2]/input").send_keys("12345")
        wd.find_element_by_xpath("//div[@class='modal-content']//button[.='ADD']").click()
        wd.find_element_by_id('inputWebSite').send_keys('www.test.com')
        wd.find_element_by_id('inputDescription').send_keys('test')
        # enter Administration Staff
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[1]/div[1]/input").click()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[1]/div[1]/input").clear()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[1]/div[1]/input").send_keys(
            "VAD First Name 29")
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]").click()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[1]/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[1]/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[1]/div[2]/input").send_keys(
            "VAD Last Name 29")
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[2]/div[1]/input").click()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[2]/div[1]/input").clear()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[2]/div[1]/input").send_keys(
            "[email protected]")
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[3]/div[1]/div/div[2]/input").click()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[3]/div[1]/div/div[2]/input").clear()
        wd.find_element_by_xpath("//div[@class='form-horizontal']/div[14]/div[3]/div[1]/div/div[2]/input").send_keys(
            "12345678")
        wd.find_element_by_xpath("//div[@class='nav-bar-button']//button[.='SAVE & EXIT']").click()
        # upload Avatar
        # wd.find_element_by_css_selector("input.btn-upload.firepath-matching-node").click()
        # wd.find_element_by_css_selector("button.btn.cancel").click()
        # wd.find_element_by_class_name("btn-upload").send_keys("C:/Users/olga.ostapenko/Desktop/Pics/test2.jpg")

    def tearDown(self):
        print('OK')
开发者ID:oostapenko84,项目名称:python_training,代码行数:69,代码来源:test_create_vendor.py


注:本文中的selenium.webdriver.firefox.webdriver.WebDriver.maximize_window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。