检测硒测试是否在Bitbucket管道中运行

时间:2020-06-15 13:12:51

标签: python selenium webdriver bitbucket-pipelines xvfb

我想知道是否可以做这样的事情:

if( "#in bitbucket pipeline" ):

        options = Options()
        options.headless = True
        cls.selenium = WebDriver(options=options)

else:
        cls.selenium = WebDriver()

仅仅是因为我需要在bitbucket上无头运行测试,而在本地环境中却不需要。

Python 3.6

django 3

1 个答案:

答案 0 :(得分:0)

我能够通过一种检查测试是否在Docker容器中运行的方法来克服它