Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

单个元素的定位,返回类型是poium Element,导致调selenium的drag_and_drop 报错move_to requires a WebElement #35

Open
herbyhabi opened this issue Jun 7, 2022 · 1 comment

Comments

@herbyhabi
Copy link

herbyhabi commented Jun 7, 2022

node_combiner_loc = Element(xpath='xxxx')
connect_point_list_loc = Elements(xpath='xxxxxx')

def drag_el1_to_el2(self):
self.node_start_loc.click()
print(self.connect_point_list_loc) # 元素list
print(self.node_combiner_loc) # 单个元素
ActionChains(self.driver).drag_and_drop(self.connect_point_list_loc[0], self.node_combiner_loc).perform()

执行时提示:
AttributeError: move_to requires a WebElement

打印出来的元素类型:
connect_point_list_loc:
[<selenium.webdriver.remote.webelement.WebElement (session="1cea47d0fadcbda3a11877b5c3d228bd", element="4f22683b-e2ee-4f42-9f7b-235e4b013598")>]

node_combiner
<poium.page_objects.Element object at 0x7ff003f36a10>

想问下,这种情况要怎么解决?

@defnngj
Copy link
Collaborator

defnngj commented Jun 22, 2022

drag_and_drop() 要的元素是 WebElement 类对象。 poium 返回的 是 Element 类对象。 所以 无解。 你只能 写 selenium 的定位。

node_combiner_loc = driver.find_element_by_xpath('xxxx')
connect_point_list_loc = driver.find_elements_by_xpath('xxxxxx')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants