parent
8a0ddbd150
commit
8f4bc1be64
@ -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)
|
||||||
|
|
||||||
|
driver.get('http://127.0.0.1:5500/github-profiles/index.html')
|
||||||
|
|
||||||
|
element = driver.find_element(By.XPATH, '//form[@class="user-form"]')
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
if element:
|
||||||
|
print('Search bar is visible')
|
||||||
|
else:
|
||||||
|
print('Search bar not visible')
|
||||||
|
|
||||||
|
# Close the browser window
|
||||||
|
driver.quit()
|
@ -0,0 +1,29 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
driver.get('http://127.0.0.1:5500/github-profiles/index.html')
|
||||||
|
|
||||||
|
element = driver.find_element(By.XPATH, '//*[@id="search"]')
|
||||||
|
|
||||||
|
placeholder_text = element.get_attribute('placeholder')
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
if placeholder_text:
|
||||||
|
print('Placedholder text is visible')
|
||||||
|
else:
|
||||||
|
print('Placedholder text not visible')
|
||||||
|
|
||||||
|
# Close the browser window
|
||||||
|
driver.quit()
|
@ -0,0 +1,33 @@
|
|||||||
|
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
|
||||||
|
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||||
|
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)
|
||||||
|
|
||||||
|
driver.get('http://127.0.0.1:5500/github-profiles/index.html')
|
||||||
|
|
||||||
|
element = driver.find_element(By.XPATH, '//*[@id="search"]')
|
||||||
|
|
||||||
|
element.send_keys('Hammad1007')
|
||||||
|
element.send_keys(Keys.ENTER)
|
||||||
|
|
||||||
|
wait = WebDriverWait(driver, 10)
|
||||||
|
main_element = wait.until(EC.presence_of_element_located((By.ID, 'main')))
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
print('Success!')
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
driver.get('http://127.0.0.1:5500/github-profiles/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('Body is visible')
|
||||||
|
else:
|
||||||
|
print('Body not visible')
|
||||||
|
|
||||||
|
print(f'The body background color is {background_color}')
|
||||||
|
|
||||||
|
# Close the browser window
|
||||||
|
driver.quit()
|
@ -0,0 +1,26 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
driver.get('http://127.0.0.1:5500/github-profiles/index.html')
|
||||||
|
|
||||||
|
element = driver.find_element(By.TAG_NAME, 'body')
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
if element:
|
||||||
|
print('Body is visible')
|
||||||
|
else:
|
||||||
|
print('Body not visible')
|
||||||
|
# Close the browser window
|
||||||
|
driver.quit()
|
@ -0,0 +1,22 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
driver.get('http://127.0.0.1:5500/github-profiles/index.html')
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
print('Homepage opens up')
|
||||||
|
|
||||||
|
# Close the browser window
|
||||||
|
driver.quit()
|
Loading…
Reference in new issue