Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created September 15, 2022 08:33
Show Gist options
  • Save SarahElson/6510c9ab6a34b3f21315ae9b54293392 to your computer and use it in GitHub Desktop.
Save SarahElson/6510c9ab6a34b3f21315ae9b54293392 to your computer and use it in GitHub Desktop.
How To Drag And Drop In Selenium With Python?
def setUp(self):
username = "your_lambdatest_username"
# Register on lambdatest, if you’ve not already. It hardly takes 30 seconds to 2 minutes to get started.
accessToken = "your_lambdatest_accessToken"
# You can find access token post registration on your LambdaTest profile page.
gridUrl = "hub.lambdatest.com/wd/hub"
desired_cap = {
'platform' : "win10",
'browserName' : "chrome",
'version' : "67.0",
"resolution": "1024x768",
"name": "LambdaTest python selenium drag and drop test ",
"build": "LambdaTest python selenium drag and drop actionChains",
"network": True,
"video": True,
"visual": True,
"console": True,
}
# Desired capabilities dictionary specifies details of the testing environment. Manipulate this dictionary to cross-test on multiple browsers and OS’s.
url = "https://"+username+":"+accessToken+"@"+gridUrl
print("Initiating remote driver on platform: "+desired_cap["platform"]+" browser: "+desired_cap["browserName"]+" version: "+desired_cap["version"])
self.driver = webdriver.Remote(
desired_capabilities=desired_cap,
command_executor= url
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment