Update test_workflow.py

This commit is contained in:
Leon 2023-06-03 00:21:24 +02:00 committed by GitHub
parent bd81310c26
commit 0ecf670b57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 18 deletions

View File

@ -1,35 +1,36 @@
import time
import logging
import os
logging.basicConfig(level=10)
from selenium.webdriver.remote.webdriver import By
logging.basicConfig(level=10)
logger = logging.getLogger(__name__)
import selenium.webdriver.support.expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from pathlib import Path
import undetected_chromedriver as uc
def main():
# due to the randomneess of the chrome install path on the runner when running action, i have to find it manufally
for k,v in os.environ.items():
logger.info("%s = %s" % (k,v))
tmp = Path('/tmp')
for item in tmp.glob('chrome*'):
print(item)
time.sleep(1)
if item.is_dir():
path_list = os.environ['PATH'].split(os.pathsep)
path_list.insert(0, str(item))
os.environ['PATH'] = os.pathsep.join(path_list)
def main():
time.sleep(5)
driver = uc.Chrome(headless=True)
driver.get("https://nowsecure.nl")
WebDriverWait(driver, 15).until(EC.text_to_be_present_in_element(("css selector", "main h1"), "OH YEAH, you passed!"))
WebDriverWait(driver, 15).until(
EC.text_to_be_present_in_element(("css selector", "main h1"), "OH YEAH, you passed!"))
driver.quit()
if __name__ == "__main__":
main()