But selenium didn't have a copy command! (Maybe I just overlooked it)
I thought I should do ctrl + C with sendkeys, but I can't
Environment: ubuntu12.04, python2.7, selenium, chrome
python
copy = driver.execute_script("return window.getSelection().toString();")
Extract the characters in the selection with execute_script and assign them to variables
I ran javascript from selenium and was able to copy it! !!
By the way, all selections are like this
python
driver.execute_script("document.execCommand('SelectAll');")
Recommended Posts