View / Edit content before social media post

We have a use case for a plugin we’re making. A user can see a backlog of content and edit it before posting to a social media website, similar to tools like Buffer.

Option 1: Push content into a social media post editor so that user can view and edit it before posting.
Option 2: Show the content in the plugin’s interface for edit and then automatically post using plugin post button

We’ve done Option 1, but our implementation is brittle and depends on the DOM of the page. Is that OK? Or should we go to Option 2?

Hi @luke.smith,

We can discuss here.

If you use a DOM to post to a site, rather than an approved API, you’ll always have a problem with brittleness. In those cases you generally need automated tests to let you know when the DOM changes, since your plugin will no longer continue working.


IMO, if the social media website you are using has an API that is compatible with the functionality you’re providing I’d suggest using that since it’ll be more reliable.

Otherwise, stay with the Option 1 but implement the tests that @anand has suggested, so you are on top of the situation with timely updates when DOM changes. You could also consider using more generic selectors, since the structure of the page is not as likely to change as its layout/styling.

@luke.smith Please take lead on discussion.You can explain technical limitation and research better .

Thanks for the response.
The site has very good api methods, the issue is it automates the entire process of posting the content. This would normally be fine but in the case of the project I want users to be able to review the content before it is posted.
Re: more generic selectors, this is what I initially started out with but the site is also obfuscating classnames/ids by dynamically changing them quite frequently.

1 Like

Thanks for the response, I’m interested in implementing the automated tests you mention, do you have any more information on how I would go about researching these kinds of tests?

Also need help with the following issues which will need to be addressed if going down the automated JS route:

  1. User will not have images/videos/files saved
  2. There is no way to automate the process of attaching the files to the post even if they do have them saved, so the user would manually have to locate and attach the files to the post themselves which we probably don’t want.
    Does anyone have any ideas on how to bypass these issues? Problem #2 seems insurmountable as I know of no way to automate the process of attaching the files via the client’s file browser

Bump, this issue is becoming high priority

There are lots of automated test frameworks available; one example is Selenium.

I’m not sure why you can’t automate submitting a file directly into the destination form. You can specify a local URL, can’t you?

No, there is only the option to select a file via file browser which as far as I know is not possible to automate due to security constraintsScreenshot 2020-09-02 at 15.40.56

It is not really possible or advisable to automate this step; the closest approach is this:

If it is not possible to skip a file selection step, then consider just accommodating this in the UX of your app. For example, ask a user to upload files at the point they select these for storage.

Finally, you probably already know about Selenium, but you can automate the entire interaction in a separate automated browser.