Webdriver & Wordpress Issues

judaculla

Regular Member
Joined
Oct 11, 2014
Messages
338
Reaction score
134
Does anyone have any experience posting content to wordpress.com (the free kind of wordpress, not self-hosted) websites with Webdriver?

I'm having some issues that I don't know how to diagnose.

I can post some content without any issue. However, when the content seems to be longer (which is what needs to happen) there seems to be a very odd issue. The UI of wordpress.com's editor kind of freezes up, scrolls down, and then actually posts what content has been entered so far. Additionally, it seems to trigger some sort of pop-up dialog box to ? switch users maybe ?.

I've tried to split the content up into smaller blocks, posting only 50-100 chars at a time, then waiting, and it seems to help ...some but still causes issues.

If anyone has any insight into this issue, or would be willing to share their general approach, I'd be much appreciative.

UPDATED:

I can copy/paste the content into Wordpress.com with webdriver—and there is no issue with the content appearing. (There is a lot of issues doing it this way IMO though)

I'm pretty unfamiliar with Webdriver, but it seems that it sends large blocks of text in smaller chunks, while doing something between blocks. I think that 'something' it's doing is causing my issue.
 
Last edited:
I've little experience with the Webdriver API, is the following code similar to what you recommend?

Code:
element = driver.find_element_by_css_selector('#my_element')

driver.execute_script('arguments[0].setAttribute(''my-text)', element)

Assuming the
Code:
 element
variable has value set via js on page?

I'm pulling this from here
 
It can be somthing like yours but use "value" directly for arguments[0] or try with:

Code:
driver.execute_script("document.getElementById('my_element').value = 'my_text';")
 
It can be somthing like yours but use "value" directly for arguments[0] or try with:

Code:
driver.execute_script("document.getElementById('my_element').value = 'my_text';")

Thanks, that approach seems more straight forward.
 
Back
Top