I am currently using action chains in selenium using Python3 to perform clicks on an element. Performing the two action chains required currently takes ~0.6 seconds I need them to be executed in < 0.1 seconds.
Until now I have been using pyautogui and setting pyautogui.PAUSE to 0. This allows me to pull off both clicks in less than 0.05 seconds but it because it is actually moving the mouse, I cannot use the computer while it is testing in that manor. I also cannot run multiple tests concurrently using pyautogui. Throughout my debugging I have concluded that the bottleneck is the execution step.
Now correct me if I am horrifically wrong, but in my understanding it would seem that selenium should be faster than pyautogui seeing as how it simply skips a step and goes straight to the browser. Because of this, I am thinking that selenium might be artificially slowing down the action chains. If so, does anybody know how to keep it from doing that?
Bellow, I have added the code that I am currently using. Takes ~0.3 seconds per click.
action_1 = webdriver.common.action_chains.ActionChains(driver)
action_1.move_to_element_with_offset(e, offset[0], offset[1])
action_1.click()
action_1.perform()
[Update]: I separated the action chains into individual actions and found the following:
- calculating the action chains takes 0.008-0.009 seconds
- moving to the first click takes 0.25-0.27 seconds
- clicking the first takes 0.013-0.014 seconds
- moving to the second click takes 0.25-0.27 seconds
- clicking the second takes 0.06-0.09 seconds
action_1.pause(1)
I'm really curious about an answer to this question also. – Cite