Skip to content

Commit

Permalink
Changed to a custom defined function to set up the browser first then…
Browse files Browse the repository at this point in the history
… do testing
  • Loading branch information
eHag-FRU committed Apr 18, 2024
1 parent 8f0d62e commit 1f508d2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/selenium/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@
for option in options:
chrome_options.add_argument(option)

def open_browser(link='http://127.0.0.1:8000/index.html'):
browser = webdriver.Chrome(options = chrome_options)
browser.get(link)
return browser

def test_execute():
browser = webdriver.Chrome(options = chrome_options)
browser.get("127.0.0.1:8000/index.html")
time.sleep(1)
browser.find_element(By.NAME,'start').click()
time.sleep(4)
print(browser.execute_script('return testFunc();'))



def test_wikipedia_python_results():
Expand Down Expand Up @@ -60,8 +73,7 @@ def test_wikipedia_CPP_results():


if __name__ == "__main__":
browser = webdriver.Chrome(options = chrome_options)
browser.get("http://127.0.0.1:8000/index.html")
browser = open_browser()

#trying to open the JS file and read the whole thing in one string
#to execute the whole script
Expand Down

0 comments on commit 1f508d2

Please sign in to comment.