diff --git a/github-profiles/tests/body/searchbar/test_searchbar.py b/github-profiles/tests/body/searchbar/test_searchbar.py new file mode 100644 index 0000000..6d96033 --- /dev/null +++ b/github-profiles/tests/body/searchbar/test_searchbar.py @@ -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() \ No newline at end of file diff --git a/github-profiles/tests/body/searchbar/test_searchbar_placeholder.py b/github-profiles/tests/body/searchbar/test_searchbar_placeholder.py new file mode 100644 index 0000000..29a84d4 --- /dev/null +++ b/github-profiles/tests/body/searchbar/test_searchbar_placeholder.py @@ -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() \ No newline at end of file diff --git a/github-profiles/tests/body/searchbar/test_searchbar_search.py b/github-profiles/tests/body/searchbar/test_searchbar_search.py new file mode 100644 index 0000000..379a2d3 --- /dev/null +++ b/github-profiles/tests/body/searchbar/test_searchbar_search.py @@ -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() \ No newline at end of file diff --git a/github-profiles/tests/body/test_body.py b/github-profiles/tests/body/test_body.py new file mode 100644 index 0000000..587e1b8 --- /dev/null +++ b/github-profiles/tests/body/test_body.py @@ -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() \ No newline at end of file diff --git a/github-profiles/tests/test_body.py b/github-profiles/tests/test_body.py new file mode 100644 index 0000000..a54faa9 --- /dev/null +++ b/github-profiles/tests/test_body.py @@ -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() \ No newline at end of file diff --git a/github-profiles/tests/test_browser.py b/github-profiles/tests/test_browser.py new file mode 100644 index 0000000..63b5ba5 --- /dev/null +++ b/github-profiles/tests/test_browser.py @@ -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() \ No newline at end of file