|
@@ -27,8 +27,9 @@ from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
|
|
|
|
|
chrome_window=False
|
|
|
globalkw=None
|
|
|
-
|
|
|
+proxyport=8787
|
|
|
def brower_start(port):
|
|
|
+ global proxyport
|
|
|
options = webdriver.ChromeOptions()
|
|
|
if chrome_window:
|
|
|
browser = webdriver.Chrome(
|
|
@@ -36,14 +37,14 @@ def brower_start(port):
|
|
|
)
|
|
|
else:
|
|
|
chrome_options = webdriver.ChromeOptions()
|
|
|
- chrome_options.add_argument('--proxy-server=host.docker.internal:8787') # Specify your Kubernetes service-name here
|
|
|
+ chrome_options.add_argument('--proxy-server=host.docker.internal:'+str(proxyport)) # Specify your Kubernetes service-name here
|
|
|
chrome_options.add_argument('--ignore-certificate-errors')
|
|
|
chrome_options.add_argument("--no-sandbox")
|
|
|
chrome_options.add_argument("--disable-dev-shm-usage")
|
|
|
browser = webdriver.Remote(
|
|
|
command_executor='http://127.0.0.1:'+str(port)+'/wd/hub',
|
|
|
desired_capabilities=chrome_options.to_capabilities(),
|
|
|
- seleniumwire_options={'addr':'0.0.0.0','port':8787,'auto_config': False}
|
|
|
+ seleniumwire_options={'addr':'0.0.0.0','port':proxyport,'auto_config': False}
|
|
|
|
|
|
)
|
|
|
# seleniumwire_options = {'addr': '172.17.0.2','port':4444})
|
|
@@ -200,8 +201,11 @@ def main():
|
|
|
|
|
|
|
|
|
port=4444
|
|
|
-# if len(sys.argv) > 1 :
|
|
|
-# port=int(sys.argv[1])
|
|
|
+ if len(sys.argv) > 2 :
|
|
|
+ port=int(sys.argv[1])
|
|
|
+ proxyport=int(sys.argv[2])
|
|
|
+
|
|
|
+
|
|
|
if not chrome_window:
|
|
|
print('restart docker p{}'.format(port))
|
|
|
# os.system('sudo docker container restart p'+str(port))
|