经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 程序设计 » Python » 查看文章
python之Ai测试Applitools使用
来源:cnblogs  作者:古风尘  时间:2019/9/27 9:54:18  对本文有异议

一:Appltools下载:

  1. pip install eyes-selenium==3.16.2

    二:
    注册:Appltools账号:
    https://applitools.com/sign-up

    三、获取:API:

新建: .py文件

  1. from selenium import webdriver
  2. from applitools.selenium import Eyes
  3. class HelloWorld:
  4. global driver
  5. eyes = Eyes()
  6. # Initialize the eyes SDK and set your private API key.
  7. eyes.api_key = 'lxxxxxxx'
  8.  
  9. try:
  10. # Open a Chrome browser.
  11. driver = webdriver.Chrome()
  12. # Start the test and set the browser's viewport size to 800x600.
  13. eyes.open(driver, "Hello World!", "My first Selenium Python test!", {'width': 800, 'height': 600})
  14. # Navigate the browser to the "hello world!" web-site.
  15. driver.get('https://applitools.com/helloworld')
  16. # Visual checkpoint #1.
  17. eyes.check_window('Hello!')
  18. # Click the 'Click me!' button.
  19. driver.find_element_by_css_selector('button').click()
  20. # Visual checkpoint #2.
  21. eyes.check_window('Click!')
  22. # End the test.
  23. eyes.close()
  24. finally:
  25. # Close the browser.
  26. driver.quit()
  27. # If the test was aborted before eyes.close was called, ends the test as aborted.
  28. eyes.abort_if_not_closed()
  1. 运行即可:
    查看分运行后分析结果:
    https://applitools.com/users/login
    下面奉上Applitools官方网站:
    https://applitools.com/tutorials/
    Applitools更多sdk:
    https://applitools.com/tutorial
    Applitools文档:
    https://applitools.com/docs
    Applitools演示:
    https://applitools.com/request-demo?utm_source=tutorials
    Applitools知识库:
    https://help.applitools.com/hc/en-us/

原文链接:http://www.cnblogs.com/gufengchen/p/11594584.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号