mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Read firefox path from environment variable for performance test
This commit is contained in:
parent
9d320d5a34
commit
d8501badc0
2 changed files with 33 additions and 3 deletions
|
@ -6,13 +6,22 @@
|
|||
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
import os
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
import sys
|
||||
|
||||
|
||||
@contextmanager
|
||||
def create_gecko_session():
|
||||
firefox_binary = "./firefox/firefox/firefox"
|
||||
try:
|
||||
firefox_binary = os.environ['FIREFOX_BIN']
|
||||
except KeyError:
|
||||
print("+=============================================================+")
|
||||
print("| You must set the path to your firefox binary to FIREFOX_BIN |")
|
||||
print("+=============================================================+")
|
||||
sys.exit()
|
||||
|
||||
driver = webdriver.Firefox(firefox_binary=firefox_binary)
|
||||
yield driver
|
||||
# driver.quit() gives an "'NoneType' object has no attribute 'path'" error.
|
||||
|
@ -90,6 +99,7 @@ def run_gecko_test(testcase, timeout):
|
|||
|
||||
return [timings]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Just for manual testing
|
||||
from pprint import pprint
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue