Rhanta
Kilopat
- Katılım
- 8 Ocak 2019
- Mesajlar
- 601
Daha fazla
- Cinsiyet
- Erkek
Web otomasyonu yapıyorum her şey gayet güzel gidiyor. Fakat bir siteye girdiği zaman scroll down scroll up yaptırmaya çalışıyorum. Tüm kodları denedim yine de çalışmıyor. Error Log da vermiyor. Yardımcı olursanız çok sevinirim.
Python:
try:
# Navigate to the xxxx site.
driver.get(“https://www.xxxx.com”)
# Click on an empty area on the site.
driver.find_element(By.XPATH, "//div[@class='container']").click()
# Scroll down to the bottom of the page.
for i in range(10): # adjust the range to scroll more or less.
driver.execute_script("window.scrollBy(0, 1000);")
sleep(1) # wait for 1 second.
print("Scrolled down to the bottom of the page")
# Scroll up to the top of the page.
for i in range(10): # adjust the range to scroll more or less.
driver.execute_script("window.scrollBy(0, -1000);")
sleep(1) # wait for 1 second.
print("Scrolled up to the top of the page")
except Exception as e:
print(f"Error: {e}")