Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protecting chrome_driver manager, adding some tryings. #1481

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
protecting chrome_driver manager, adding some tryings.
renanllisboa committed Aug 20, 2024
commit 556e25f6f5c0f53e1e381fa022be406589849489
41 changes: 26 additions & 15 deletions tir/technologies/core/base.py
Original file line number Diff line number Diff line change
@@ -1101,6 +1101,7 @@ def Start(self):
"""

start_program = '#inputStartProg, #selectStartProg'
driver_path = None

if self.config.appserver_service:
try:
@@ -1127,21 +1128,31 @@ def Start(self):
if self.config.headless:
chrome_options.add_argument('force-device-scale-factor=0.77')

try:
if self.config.chromedriver_auto_install:
if self.config.ssl_chrome_auto_install_disable:
os.environ['WDM_SSL_VERIFY'] = '0'
self.driver = webdriver.Chrome(options=chrome_options,
executable_path=ChromeDriverManager().install())
else:
if sys.platform == 'linux':
driver_path = Path(__file__).parent.resolve().joinpath('drivers', 'linux', 'chromedriver.exe')
elif sys.platform == 'win32':
driver_path = Path(__file__).parent.resolve().joinpath('drivers', 'windows', 'chromedriver.exe')

self.driver = webdriver.Chrome(options=chrome_options, executable_path=str(driver_path))
except Exception as e:
raise e
if self.config.chromedriver_auto_install:

counter = 1
while counter < 3:
try:
if self.config.ssl_chrome_auto_install_disable:
os.environ['WDM_SSL_VERIFY'] = '0'
driver_path = ChromeDriverManager().install()
break
except Exception as e:
logger().info("Trying get driver_path from ChromeDriverManager().Install")
time.sleep(30)
counter += 1
if counter > 2:
raise e

else:
if sys.platform == 'linux':
driver_path = Path(__file__).parent.resolve().joinpath('drivers', 'linux',
'chromedriver.exe')
elif sys.platform == 'win32':
driver_path = Path(__file__).parent.resolve().joinpath('drivers', 'windows',
'chromedriver.exe')

self.driver = webdriver.Chrome(options=chrome_options, executable_path=str(driver_path))

elif self.config.browser.lower() == "electron":
driver_path = os.path.join(os.path.dirname(__file__), r'drivers\\windows\\electron\\chromedriver.exe')