Drop не работает. Суть в том что я приклепил логи на drag and drop. Сообщение выглядит следующим образом console.log(): При drag - drag begins, a при drop - drag end. Можете проверить сначала в ручную https://codesandbox.io/s/great-montalcini-8cs99. А потом запустить код ниже указанный.
Код
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class TestDND2():
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def test_dND2(self):
self.driver.get("https://codesandbox.io/s/great-montalcini-8cs99")
self.driver.set_window_size(1552, 840)
time.sleep(20)
self.driver.switch_to.frame(0)
dragged = self.driver.find_element(By.CSS_SELECTOR, ".ant-table-row[index='0']")
dropped = self.driver.find_element(By.CSS_SELECTOR, ".ant-table-row[index='1']")
actions = ActionChains(self.driver)
#actions.drag_and_drop(dragged, dropped).release(dragged).release().perform()
actions.click_and_hold(dragged).perform()
actions.move_by_offset(0,10).perform()
actions.move_to_element(dropped).perform()
actions.release(dropped).perform()
time.sleep(15)
self.driver.close()
Логи ============================= test session starts =============================
platform win32 – Python 3.9.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
sensitiveurl: .*
rootdir: D:\selenium-tests\new-small-library\test
plugins: anyio-2.0.2, Faker-5.0.1, asyncio-0.14.0, base-url-1.4.2, forked-1.3.0, html-3.1.0, metadata-1.11.0, selenium-2.0.1, splinter-3.3.0, tornasync-0.6.0.post2, trio-0.7.0, variables-1.9.0, xdist-2.1.0
collected 1 item
test_dND2.py . [100%]
============================= 1 passed in 55.91s ==============================
WINDOWS 10 64x
Selenium 3.17
Chrome Version 87.0.4280.88 (Official Build) (64-bit)
Python 3.9.0
pytest-6.1.2