在使用RIDE进行web自动化测试时,会发现经常运行第二遍不显示下方log,如下

八、robot framework常见错误:RIDE运行一次后不显示log

原因:

    代码使用的是谷歌浏览器、IE浏览器测试,运行一次后chromedriver.exe,IEDriverServer.exe进程仍在运行中。

 

解决方法:

方法一:每次运行后,手动关闭chromedriver.exe或者IEDriverServer.exe;

方法二:将下面代码保存为批处理,每次运行后手动运行一下:

taskkill /f /im  chromedriver.exe

taskkill /f /im  IEDriverServer.exe

方法三:封装成keywords

step1:

import os

  def close_process(self, process_name):
      """Close a process by processname."""
      if process_name[-4:].lower() != ".exe":
          process_name += ".exe"
      os.system("taskkill /f /im " + process_name)

step2:

  保存上述文件至py文件,例如ShowReportlog.py,然后在RIDE中引用,并创建关键字

 CloseChromeDriver
         Close Process chromedriver  #谷歌

         CloseProcess IEDriverServer #IE

在RIDE中引用

八、robot framework常见错误:RIDE运行一次后不显示log

创建关键字

八、robot framework常见错误:RIDE运行一次后不显示log

step3:

  将CloseChromeDriver加入test Teardown:

  *** Settings ***

  Test Teardown CloseChromeDriver

八、robot framework常见错误:RIDE运行一次后不显示log

相关文章:

  • 2021-04-11
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
  • 2021-07-22
  • 2021-12-31
  • 2021-08-26
猜你喜欢
  • 2021-04-20
  • 2021-08-07
  • 2021-09-29
  • 2021-12-12
  • 2022-12-23
  • 2022-02-15
  • 2022-01-08
相关资源
相似解决方案