本文整理汇总了Python中subprocess.Popen.port方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.port方法的具体用法?Python Popen.port怎么用?Python Popen.port使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subprocess.Popen
的用法示例。
在下文中一共展示了Popen.port方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_selenium_server
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import port [as 别名]
def start_selenium_server(display=":99"):
"""Start a selenium server on a random port."""
for _ in range(10):
info("Bringing up selenium")
port = pick_random_port()
SELENIUM_SERVER_JAR = os.environ["SELENIUM_SERVER_JAR"]
sel_server = Popen(
["java", "-jar", SELENIUM_SERVER_JAR, "-port", str(port)],
env=dict(os.environ, DISPLAY=display),
stdout=PIPE,
stderr=PIPE,
)
# Stupid selenium takes an age to start. I can't really sleep
# until I can tell it's done
sel_server.port = port
if wait_for_selenium_start(sel_server):
return sel_server
else:
continue
else:
raise Exception("Failed to start selenium server")