<tfoot id='yCDI3'></tfoot>
    <legend id='yCDI3'><style id='yCDI3'><dir id='yCDI3'><q id='yCDI3'></q></dir></style></legend>
  • <i id='yCDI3'><tr id='yCDI3'><dt id='yCDI3'><q id='yCDI3'><span id='yCDI3'><b id='yCDI3'><form id='yCDI3'><ins id='yCDI3'></ins><ul id='yCDI3'></ul><sub id='yCDI3'></sub></form><legend id='yCDI3'></legend><bdo id='yCDI3'><pre id='yCDI3'><center id='yCDI3'></center></pre></bdo></b><th id='yCDI3'></th></span></q></dt></tr></i><div id='yCDI3'><tfoot id='yCDI3'></tfoot><dl id='yCDI3'><fieldset id='yCDI3'></fieldset></dl></div>

      <small id='yCDI3'></small><noframes id='yCDI3'>

          <bdo id='yCDI3'></bdo><ul id='yCDI3'></ul>

        selenium Python中的unittest是什么?

        What is unittest in selenium Python?(selenium Python中的unittest是什么?)
          <tbody id='MHU9U'></tbody>
        <tfoot id='MHU9U'></tfoot>

      1. <small id='MHU9U'></small><noframes id='MHU9U'>

                • <bdo id='MHU9U'></bdo><ul id='MHU9U'></ul>

                  <i id='MHU9U'><tr id='MHU9U'><dt id='MHU9U'><q id='MHU9U'><span id='MHU9U'><b id='MHU9U'><form id='MHU9U'><ins id='MHU9U'></ins><ul id='MHU9U'></ul><sub id='MHU9U'></sub></form><legend id='MHU9U'></legend><bdo id='MHU9U'><pre id='MHU9U'><center id='MHU9U'></center></pre></bdo></b><th id='MHU9U'></th></span></q></dt></tr></i><div id='MHU9U'><tfoot id='MHU9U'></tfoot><dl id='MHU9U'><fieldset id='MHU9U'></fieldset></dl></div>
                  <legend id='MHU9U'><style id='MHU9U'><dir id='MHU9U'><q id='MHU9U'></q></dir></style></legend>
                  本文介绍了selenium Python中的unittest是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  3、16、17、18、19行用*高亮是什么意思.有人可以解释他们的工作吗?我是 python 和编程新手

                  What is the meaning of lines 3,16,17,18 and 19 which are highlighted with *. Can someone explain what they do? I am new to python and programming

                  import unittest
                  
                  from selenium import webdriver
                  
                  **class Iframe(unittest.TestCase):**
                  
                  def setUp(self):
                      self.driver = webdriver.Firefox()
                  
                  def test_Iframe(self):
                      driver = self.driver
                      driver.maximize_window()
                      driver.get('http://www.toolsqa.com/iframe-practice-page/')
                  
                      iframe1 = driver.find_element_by_id('IF1')
                      driver.switch_to.frame(iframe1)
                  
                      driver.find_element_by_name('email').send_keys('xyz')
                  
                      driver.switch_to.default_content()
                  
                      list = driver.find_elements_by_tag_name('iframe')
                  
                      print(len(list))
                  
                  **def tearDown(self):
                      self.driver.quit()**
                  
                  
                  **if __name__ == '__main__':
                     unittest.main()**
                  

                  推荐答案

                  这段代码中只有三行用 * 突出显示,但它们的含义如下:

                  Only three lines in this code are highlighted with an *, but here's what they mean:

                   class Iframe(unittest.TestCase):
                  

                  这是为随后的函数(test_IframetearDown)声明.class 用于在 面向对象编程.class 是数据/过程的抽象,而 object 是该类的特定实例.

                  This is declaring the class for the functions (test_Iframe and tearDown) that follow. A class is used to create "objects" in object oriented programming. Think of the class as the abstraction of data/procedures, while the object is the particular instance of the class.

                  def tearDown(self):
                  self.driver.quit()
                  

                  本节首先用def关键字声明一个函数,该函数退出驱动,设置为:

                  This section first declares a function with the def keyword, and the function quits the driver, which was set as:

                  driver = self.driver
                  driver.maximize_window()
                  driver.get('http://www.toolsqa.com/iframe-practice-page/')
                  

                  test_Iframe() 函数中.

                  if __name__ == '__main__':
                  unittest.main()
                  

                  这部分只是执行程序的主要功能.可以在这里找到更多细节.

                  This section simply executes the main function of the program. More details on this can be found here.

                  如果您还有其他问题,请告诉我!

                  Let me know if you have any more questions!

                  这篇关于selenium Python中的unittest是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                    <bdo id='WcnFV'></bdo><ul id='WcnFV'></ul>
                      <tbody id='WcnFV'></tbody>
                    1. <legend id='WcnFV'><style id='WcnFV'><dir id='WcnFV'><q id='WcnFV'></q></dir></style></legend>
                    2. <small id='WcnFV'></small><noframes id='WcnFV'>

                        <i id='WcnFV'><tr id='WcnFV'><dt id='WcnFV'><q id='WcnFV'><span id='WcnFV'><b id='WcnFV'><form id='WcnFV'><ins id='WcnFV'></ins><ul id='WcnFV'></ul><sub id='WcnFV'></sub></form><legend id='WcnFV'></legend><bdo id='WcnFV'><pre id='WcnFV'><center id='WcnFV'></center></pre></bdo></b><th id='WcnFV'></th></span></q></dt></tr></i><div id='WcnFV'><tfoot id='WcnFV'></tfoot><dl id='WcnFV'><fieldset id='WcnFV'></fieldset></dl></div>
                        <tfoot id='WcnFV'></tfoot>