Skip to content

Commit

Permalink
added automatic Opening VC and clicking File and Open button of menubar
Browse files Browse the repository at this point in the history
  • Loading branch information
BkPankaj committed Jun 6, 2024
1 parent 7ccbea0 commit 8ea1c0d
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions .github/first_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

try:
Expand All @@ -18,16 +20,36 @@
)

# Open the browser and go to the URL
driver.get('https://google.com')
driver.get('http://IP:4000')

# Wait for the page to load
time.sleep(40)
# time.sleep(120)


# Wait for the "File" button to be clickable and click it
basic_button = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.XPATH, "//button[contains(@class, 'menu-button') and .//span[text()='File']]"))
)
basic_button.click()


# Wait for the dropdown menu to be visible
dropdown_menu = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.XPATH, "//ul[@role='menu' and @aria-label='File']"))
)

# Wait for the "Open" menu item to be clickable and click it
code_menu_item = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.XPATH, "//ul[@role='menu' and @aria-label='File']//li[text()='Open']"))
)
code_menu_item.click()

time.sleep(20)


# Capture a screenshot
driver.get_screenshot_as_file('screenshot.png')

finally:
# Close the browser to ensure the session is properly terminated
# Close the browser
if driver:
driver.quit()

0 comments on commit 8ea1c0d

Please sign in to comment.