Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 如何使用Python+;Webdriver&x2B;鼻及;许尼特_Python 2.7_Selenium Webdriver_Nose_Xunit - Fatal编程技术网

Python 2.7 如何使用Python+;Webdriver&x2B;鼻及;许尼特

Python 2.7 如何使用Python+;Webdriver&x2B;鼻及;许尼特,python-2.7,selenium-webdriver,nose,xunit,Python 2.7,Selenium Webdriver,Nose,Xunit,如何使用Python+Webdriver+nose&xunit将屏幕截图捕获到报告中 Python脚本: import unittest from selenium import webdriver from selenium.webdriver.common.keys import Keys class GoogleTest(unittest.TestCase): def test_google(self): self.driver = webdriver.Fi

如何使用Python+Webdriver+nose&xunit屏幕截图捕获到报告中

Python脚本:

import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class GoogleTest(unittest.TestCase):

    def test_google(self):


        self.driver = webdriver.Firefox()
        self.driver.get("http://www.google.com")
        assert False, "Desperately failing to capture screenshot"

    def tearDown(self):

        self.driver.save_screenshot("/tmp/screenshot.png")
        print ("/tmp/screenshot.png")
        self.driver.quit()
        unittest.TestCase.tearDown(self)
请找到report.xml

<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="1" errors="0" failures="1" skip="0"><testcase classname="sample.GoogleTest" name="test_google" time="4.921"><failure type="exceptions.AssertionError" message="Desperatly failing to capture screenshot"><![CDATA[Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 331, in run
    testMethod()
  File "/home/anuj/workspace/py_sel/sample.py", line 17, in test_google
    assert False, "Desperatly failing to capture screenshot"
AssertionError: Desperatly failing to capture screenshot
]]></failure></testcase></testsuite>


这个问题很好,但你也应该分享更多的细节:到目前为止你尝试了什么,你面临的问题简化了上述问题的示例脚本这个问题很好,但你也应该分享更多的细节:到目前为止你尝试了什么,您在尝试时遇到的问题简化了上述问题的示例脚本