2024-04-19 20:50:13 发布
网友
我试着在用户界面上画一个矩形,类似于画画,文字的形状。 形状是使用浏览器的x-y坐标制作的,因为没有元素与之关联。在
下面是我用来绘制矩形的代码,我无法绘制它:
pyautogui.click(x=800,y=500,) pyautogui.dragTo(x=1000,y=800,button='left') time.sleep(2) pyautogui.doubleClick(x=400,y=400)
您需要使用具有拖放功能的Actions类
示例代码:-
source1 = driver.find_element_by_id('draggable') action = ActionChains(driver) #move element by x,y coordinates on the screen action.drag_and_drop_by_offset(source1, 100, 100)
下面是一些参考:在
https://seleniumwithjavapython.wordpress.com/selenium-with-python/intermediate-topics/drag-and-drop-scenarios/
http://www.software-testing-tutorials-automation.com/2014/10/selenium-webdriver-drag-and-drop.html
希望对您有帮助:)
您需要使用具有拖放功能的Actions类
示例代码:-
下面是一些参考:在
https://seleniumwithjavapython.wordpress.com/selenium-with-python/intermediate-topics/drag-and-drop-scenarios/
http://www.software-testing-tutorials-automation.com/2014/10/selenium-webdriver-drag-and-drop.html
希望对您有帮助:)
相关问题 更多 >
编程相关推荐