parent
d92de05e86
commit
1eb3737e81
@ -0,0 +1,39 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
# Find and click the button
|
||||
button = driver.find_element(By.XPATH, '/html/body/button')
|
||||
button.click()
|
||||
|
||||
# Wait for the changes to take effect (adjust wait time as needed)
|
||||
try:
|
||||
# Find the new button after the changes
|
||||
button = driver.find_element(By.XPATH, '/html/body/button')
|
||||
|
||||
# Retrieve properties
|
||||
text = button.text
|
||||
background_color = button.value_of_css_property('background-color')
|
||||
text_color = button.value_of_css_property('color')
|
||||
|
||||
print(f'The text in the button is {text}')
|
||||
print(f'The button background color is {background_color}')
|
||||
print(f'The text color is {text_color}')
|
||||
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,37 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '/html/body/button')
|
||||
|
||||
text = element.text
|
||||
|
||||
background_color = element.value_of_css_property('background-color')
|
||||
|
||||
text_color = element.value_of_css_property('color')
|
||||
|
||||
if element:
|
||||
print('The button is found')
|
||||
else:
|
||||
print('The button has not been found')
|
||||
|
||||
print(f'The text in buton is {text}')
|
||||
|
||||
print(f'The button background color is {background_color}')
|
||||
|
||||
print(f'The text color is {text_color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,44 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '/html/body/div[1]/div[3]')
|
||||
|
||||
date_element = driver.find_element(By.XPATH, '/html/body/div[1]/div[3]/span')
|
||||
|
||||
text = element.text
|
||||
|
||||
background_color = element.value_of_css_property('background-color')
|
||||
|
||||
color = element.value_of_css_property('color')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The complete date is found')
|
||||
else:
|
||||
print('The complete date is not found')
|
||||
|
||||
if date_element:
|
||||
print('The date has been found')
|
||||
else:
|
||||
print('The date hasn\'t been found')
|
||||
|
||||
print(f'Date is {text}')
|
||||
print(f'Background Color is {background_color}')
|
||||
print(f'Text color is {color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,27 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '//div[@class="clock-container"]')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The clock is found.')
|
||||
else:
|
||||
print('The clock is not found.')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,37 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '/html/body/div[1]/div[2]')
|
||||
|
||||
text = element.text
|
||||
|
||||
background_color = element.value_of_css_property('background-color')
|
||||
|
||||
color = element.value_of_css_property('color')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The time is found')
|
||||
else:
|
||||
print('The time is not found')
|
||||
|
||||
print(f'Time is {text}')
|
||||
print(f'Color is {background_color}')
|
||||
print(f'Text color is {color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,31 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[1]')
|
||||
|
||||
color = element.value_of_css_property('background-color')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The hour needle is found.')
|
||||
else:
|
||||
print('The hour needle is not found.')
|
||||
|
||||
print(f'The color of hour needle is: {color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,31 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[2]')
|
||||
|
||||
color = element.value_of_css_property('background-color')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The minute needle is found.')
|
||||
else:
|
||||
print('The minute needle is not found.')
|
||||
|
||||
print(f'The color of minute needle is: {color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,31 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '/html/body/div[1]/div[1]/div[3]')
|
||||
|
||||
color = element.value_of_css_property('background-color')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The second needle is found.')
|
||||
else:
|
||||
print('The second needle is not found.')
|
||||
|
||||
print(f'The color of second needle is: {color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,27 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.XPATH, '//div[@class="clock"]')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The clock is found.')
|
||||
else:
|
||||
print('The clock is not found.')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,31 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.TAG_NAME, 'body')
|
||||
|
||||
background_color = element.value_of_css_property('background-color')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The body is found.')
|
||||
else:
|
||||
print('The body is not found.')
|
||||
|
||||
print(f'The background color is {background_color}')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,27 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
element = driver.find_element(By.TAG_NAME, 'body')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
if element:
|
||||
print('The body is found.')
|
||||
else:
|
||||
print('The body is not found.')
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
@ -0,0 +1,20 @@
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
|
||||
# Define Chrome WebDriver options
|
||||
chrome_options = Options()
|
||||
service = Service('/Users/mac005/Downloads/chromedriver-mac-arm64/chromedriver')
|
||||
|
||||
# Initialize Chrome WebDriver
|
||||
driver = webdriver.Chrome(service=service, options=chrome_options)
|
||||
# Open the Flask application
|
||||
driver.get('http://127.0.0.1:5500/theme-clock/index.html')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
# Close the browser window
|
||||
driver.quit()
|
Loading…
Reference in new issue