Home | History | Annotate | Download | only in functional
      1 #!/usr/bin/env python
      2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 import pyauto_functional
      7 import pyauto
      8 
      9 
     10 class PyAutoWebDriverTest(pyauto.PyUITest):
     11   """Tests PyAuto-WebDriver integration."""
     12 
     13   def testTypeIntoTextBox(self):
     14     """Type into a text input box and verify its value."""
     15     driver = self.NewWebDriver()
     16     driver.get('about:blank')
     17     driver.execute_script('document.body.innerHTML = "<input type=\'text\'>"')
     18     input = driver.find_element_by_tag_name('input')
     19     self.assertEquals('', input.get_attribute('value'))
     20     input.send_keys('test')
     21     self.assertEquals('test', input.get_attribute('value'))
     22 
     23   def testCanConnectToRestartedBrowser(self):
     24     """Restart the browser and connect again with WebDriver."""
     25     driver = self.NewWebDriver()
     26     self.RestartBrowser()
     27     driver = self.NewWebDriver()
     28     driver.get('about:blank')
     29     self.assertEquals('about:blank', driver.title)
     30 
     31 
     32 if __name__ == '__main__':
     33   pyauto_functional.Main()
     34