I am trying to automatically paste an anchor text link into a Facebook Note. Please try the following scenario: Go to any site and locate anchor text with a hyperlink. Manually, with the mouse, left click and swipe across the text. Then, right click and select copy (not Copy link address). You have now copied the text and link to the clipboard as a single entity. Now open Facebook notes, create a note and paste and the link will be inserted. Pasting into MS Word also works. Please refer to the attached image from Facebook. I pasted Link-1 which is clickable and goes to a new site. Inserted html (Link-2) is rejected. So, what I need is to automate the mouse left click, swipe the located text element (I know how to find the element), right click it and select Copy.
Asked
Active
Viewed 251 times
-1
-
Check this ticket http://stackoverflow.com/questions/11750447/performing-a-copy-and-paste-with-selenium-2 – Andersson Dec 26 '16 at 20:31
-
I ran the example in ticket http://stackoverflow.com/questions/11750447/performing-a-copy-and-paste-with-selenium-2 it works for copy and paste text but, if I am correct, not for copying and pasting something like Link preserving the link which I can do manually. – Userqwe Dec 28 '16 at 14:52
-
I was in error with the above. I still do not have a solution. I need to know how to automatically swipe (with the mouse) or highlight anchor text on a webpage. Right click and copy it to the clipboard so that I can paste it to another site while retaining the embedded link. I do not mean “Copy the link” I need to “Copy”. – Userqwe Jan 05 '17 at 19:32
1 Answers
0
Finding the element and using driver.send_keys(Keys.CONTROL, 'c') copied the anchor text to the clipboard successfully. I was able to paste it manually and click on it to go to the URL.
QED

Userqwe
- 1
- 4
-
I was in error with the above. I still do not have a solution. I need to know how to automatically swipe (with the mouse) or highlight anchor text on a webpage. Right click and copy it to the clipboard so that I can paste it to another site while retaining the embedded link. I do not mean “Copy the link” I need to “Copy”. – Userqwe Jan 05 '17 at 19:33