fix: event system
This commit is contained in:
@@ -8,13 +8,16 @@ from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
|
||||
def generateURL(lat=49.103814, lon=55.794258, zoom=10):
|
||||
return f"https://yandex.ru/maps/43/kazan/?ll={lat}%2C{lon}&z={zoom}"
|
||||
|
||||
class YandexMap:
|
||||
def __init__(self):
|
||||
options = webdriver.ChromeOptions()
|
||||
# options.add_experimental_option("detach", True)
|
||||
self.driver = webdriver.Chrome(options)
|
||||
self.driver.get("https://yandex.ru/maps/43/kazan/?ll=49.103814%2C55.794258&z=10")
|
||||
sleep(5)
|
||||
self.driver.get(generateURL())
|
||||
sleep(2)
|
||||
|
||||
action = ActionChains(self.driver)
|
||||
|
||||
@@ -31,10 +34,10 @@ class YandexMap:
|
||||
action.move_to_element_with_offset(html, 200, 200)
|
||||
action.perform()
|
||||
|
||||
sleep(5)
|
||||
sleep(1)
|
||||
|
||||
def savePhoto(self, filename: str) -> bytes:
|
||||
return self.driver.save_screenshot(filename)
|
||||
|
||||
|
||||
def destroy(self):
|
||||
self.driver.close()
|
||||
|
||||
Reference in New Issue
Block a user