-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path26_selenium.py
39 lines (29 loc) · 1.01 KB
/
26_selenium.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
surucu = webdriver.Firefox(executable_path="D:/Program Dosyaları/Selenium Firefox Sürücüsü/geckodriver.exe")
url = "https://github.com"
surucu.get(url)
# time.sleep(2)
# surucu.maximize_window
# surucu.save_screenshot("github_ekran_goruntusu.png")
# url = "https://github.com/cagataysarioglu"
# surucu.get(url)
# print(surucu.title)
# if "kursadgokboru" in surucu.title:
# surucu.save_screenshot("github_kursadgokboru_eg.png")
# time.sleep(2)
# surucu.back()
# time.sleep(2)
# surucu.close()
### SELENIUM İLE SAYFA ETKİLEŞİMİ ###############
aramaGirdisi = surucu.find_element_by_name("q") # find_element_by_xpath ile de kullanım yapabiliriz.
time.sleep(1)
aramaGirdisi.send_keys("python")
time.sleep(2)
aramaGirdisi.send_keys(Keys.ENTER)
time.sleep(2)
islem = surucu.find_elements_by_css_selector(".repo-list-item a")
for eleman in islem:
print(eleman.text)
surucu.close()