python advanced - 15 - Selenium
Advanced modules-1 - Advanced modules-2 - data mining - selenium - numpy
Selenium installation
pip install selenium
sonra chrome eklentisini kur: ---bu degismis --->>>
https://chromedriver.storage.googleapis.com/index.html?path=114.0.5735.90/ (not: bendeki versiyon - 2024 - Agustos - 127.0 ve boyle bir download a benzer bile bisey yok, acaba artik gerek yok mu?)
download eklentiyi, python calisma klasorume cut paste yap:
C:\ohkp\prog_tutorial_test\python-exercise - chromedriver.exe
------<<<
sadece sunu msdos python dosyasi altinda run et:
pip install webdriver-manager
file adi selenium.py olmamali
--- test icin bu websitedeki programi kopyala:
voila!
web browser`i acip web sayfasina gidis
from selenium import webdriver
import time
driver=webdriver.Chrome()
url="http://sadikturan.com"
driver.get(url)
web browser tam ekran bekle screenshot etc
url="http://github.com"
driver.get(url)
time.sleep(2)
driver.maximize_window()
time.sleep(2)
driver.save_screenshot("gith.jpg")
we sayfa acip arama
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
driver=webdriver.Chrome()
url="https://www.something.com/"
driver.get(url)
time.sleep(2)
searchbox = driver.find_element(By.CLASS_NAME,"class_name").click
searchbox = driver.find_element(By.NAME,"name_element")
time.sleep(5)
searchbox.send_keys("python");
time.sleep(5)
searchbox.send_keys(Keys.RETURN);
time.sleep(2)
driver.close()
Not: ders notlari 2019 civarlarina ait. teknoloji degistigi icin selenium ile alakalı dersler çalışmıyor. Selenium a karşı siteler güvenlik önlemlerini yükseltmişler.
Comments
Post a Comment