Created
December 28, 2021 11:02
-
-
Save Anas-jaf/dc85d223171dc25e97804d31fbf28bb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
driver = webdriver.Firefox() | |
driver.get("https://github.com/search?q=python%2Fcpython&type=") | |
elem = driver.find_element_by_name("q") | |
elem.click() | |
elem.send_keys("python/cpython") | |
elem.send_keys(Keys.RETURN) | |
# time.sleep(2) | |
# elem1= driver.find_element_by_xpath("//*[contains(text(), 'cpython')]") | |
driver.find_element_by_link_text("python/cpython").click() | |
elems = driver.find_elements_by_xpath("//a[@href]") | |
for elem in elems: | |
if elem.get_attribute("href") == "https://travis-ci.com/python/cpython": | |
print ("Found!") | |
elif elem.get_attribute("href") == "https://github.com/python/cpython/actions": | |
print ("Found!") | |
elif elem.get_attribute("href") == "https://dev.azure.com/python/cpython/_build/results?buildId=93713&view=results": | |
print ("Found!") | |
elif elem.get_attribute("href") == "https://discuss.python.org/": | |
print ("Found!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment