I have tried
page_source and it doesn’t do what I need to have done. However, I can get the page open in webdriver and it is showing the source code but I haven’t been able to select the content and copy it to the clipboard.
I am on a Mac OS X 10.10.5 so I used:
But the only thing that happened was I got an “a” and a “c” passed to the page.
I have tried using the context menu of the finder and I can get it to show but can”t get it to select the “select all” option.
btn = driver.wait.until(EC.visibility_of_element_located((By.XPATH, "//textarea[@key='postBody']"))) actionChains = ActionChains(driver) action = actionChains.context_click(btn).perform() links = action.find_element(By.LINK_TEXT, "Select All") links.click()
Using the above code I get this error:
Traceback (most recent call last): File "expertsBrazil2webdriver.py", line 80, in <module> links = action.find_element(By.LINK_TEXT, "Select All") AttributeError: 'NoneType' object has no attribute 'find_element'
So please tell me a workable approach to get Webdriver to copy the content of the page to the clipboard.
Source link https://sqa.stackexchange.com/questions/22605/need-to-copy-source-code-of-cms-page-in-python-webdriver