示例#1
0
 def test_invalid_command(self):
     element = ElementState(locators=[Locator(by=By.NAME, value="q")])
     element.save()
     command = Command(command="INVALID",
                       element=element,
                       params="Something")
     response = command.execute(self.driver, config=RunConfig())
     assert not response.passed, response.exception
示例#2
0
 def test_execute_navigate(self):
     command = Command(command=Command.NAVIGATE, config_key="url")
     command.execute(
         self.driver,
         config=RunConfig(params={"url": "http://www.google.com/"}))
     assert self.driver.current_url == "https://www.google.com/?gws_rd=ssl", self.driver.current_url
示例#3
0
    def test_navigate(self):
        self.driver.get("http://www.google.com/")
        command = Command(driver=self.driver, command=Command.NAVIGATE,config_key="url")
        command.execute(self.driver, config=RunConfig(params={"url":"http://www.google.com/"}))

        assert "google" in self.driver.current_url
示例#4
0
 def test_click(self):
     self.driver.get("http://www.google.com/")
     command = Command(driver=self.driver, command=Command.CLICK,element=ElementState(locators=[Locator(by=By.NAME,value="q")]))
     command.execute(self.driver, config=RunConfig())
示例#5
0
    def test_send_keys(self):
        self.driver.get("http://www.google.com/")
        command = Command(driver=self.driver, command=Command.SENDKEYS,element=ElementState(locators=[Locator(by=By.NAME,value="q")]),config_key="search")
        command.execute(self.driver, config=RunConfig(params={"search":"Something"}))

        assert WebElement(self.driver, [Locator(by=By.NAME,value="q")]).value == "Something"