Created
May 9, 2020 14:34
-
-
Save ThibaudLamothe/84f74083499c1522aa77255606e32b93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Getting button location on the html tree | |
button_css = ' div.lmt__target_toolbar__copy button' | |
# Getting the button object | |
button = driver.find_element_by_css_selector(button_css) | |
# Extracting its position | |
y = button.location['y'] | |
# Positionning the button into the screen | |
driver.execute_script("window.scrollTo(0, {})".format(y - 150)) | |
# Getting the button object | |
# (again - its position has been actualized and we need to get the new positions for the click) | |
button = driver.find_element_by_css_selector(button_css) | |
# Making the click => translation is now in our clipboard | |
button.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment