|
@@ -7,13 +7,28 @@ from selenium.webdriver.common.keys import Keys
|
|
|
import time
|
|
|
|
|
|
|
|
|
-def brower_start(port):
|
|
|
+def brower_start(port, proxyport, chrome_window):
|
|
|
+ print(proxyport)
|
|
|
options = webdriver.ChromeOptions()
|
|
|
- browser = webdriver.Remote(
|
|
|
- command_executor='http://127.0.0.1:'+str(port)+'/wd/hub',
|
|
|
- desired_capabilities=options.to_capabilities()
|
|
|
- )
|
|
|
- return browser
|
|
|
+ if chrome_window:
|
|
|
+ browser = webdriver.Chrome(
|
|
|
+ desired_capabilities=options.to_capabilities()
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ chrome_options = webdriver.ChromeOptions()
|
|
|
+ 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':proxyport,'auto_config': False}
|
|
|
+
|
|
|
+ )
|
|
|
+# seleniumwire_options = {'addr': '172.17.0.2','port':4444})
|
|
|
+ browser.set_window_size(1400,1000)
|
|
|
+ return browse
|
|
|
|
|
|
|
|
|
def brower_start2(port):
|