Skip to content

Commit

Permalink
removed file which was accidentally created
Browse files Browse the repository at this point in the history
+ added mouse_drag_boxes.py to examples
  • Loading branch information
ultrafunkamsterdam committed Apr 30, 2024
1 parent 2a6eb78 commit 57cb72b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 45 deletions.
70 changes: 70 additions & 0 deletions example/mouse_drag_boxes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

from nodriver import *


async def main():
browser = await start()
await demo_drag_to_target(browser)
await demo_drag_to_target_in_steps(browser)
await demo_drag_to_absolute_position(browser)
await demo_drag_to_absolute_position_in_steps(browser)
await demo_drag_to_relative_position(browser)
await demo_drag_to_relative_position_in_steps(browser)


async def demo_drag_to_target(browser):
tab = await browser.get('https://nowsecure.nl/mouse.html?boxes=50')
boxes = await tab.select_all('.box')
area = await tab.select('.area-a')
for box in boxes:
await box.mouse_drag(area)


async def demo_drag_to_target_in_steps(browser):

tab = await browser.get('https://nowsecure.nl/mouse.html')
boxes = await tab.select_all('.box')
area = await tab.select('.area-a')

for box in boxes:
await box.mouse_drag(area, steps=100)


async def demo_drag_to_absolute_position(browser):
tab = await browser.get('https://nowsecure.nl/mouse.html?boxes=50')
boxes = await tab.select_all('.box')
area = await tab.select('.area-a')

for box in boxes:
await box.mouse_drag((500, 500))


async def demo_drag_to_absolute_position_in_steps(browser):
tab = await browser.get('https://nowsecure.nl/mouse.html')
boxes = await tab.select_all('.box')
area = await tab.select('.area-a')

for box in boxes:
await box.mouse_drag((500, 500), steps=50)


async def demo_drag_to_relative_position(browser):
tab = await browser.get('https://nowsecure.nl/mouse.html?boxes=50')
boxes = await tab.select_all('.box')

for box in boxes:
await box.mouse_drag((500, 500), relative=True)


async def demo_drag_to_relative_position_in_steps(browser):
tab = await browser.get('https://nowsecure.nl/mouse.html')
boxes = await tab.select_all('.box')

for box in boxes:
await box.mouse_drag((500, 500), relative=True, steps=50)




if __name__ == '__main__':
loop().run_until_complete(main())
45 changes: 0 additions & 45 deletions nodriver/core/extra.py

This file was deleted.

0 comments on commit 57cb72b

Please sign in to comment.