X
X
xidios2020-09-22 19:36:36
JavaScript
xidios, 2020-09-22 19:36:36

How to implement an extension that will automatically post text to a Steam discussion?

5f6a271d296da949764299.png

I reviewed the vidos with all possible extensions, the task seems trivial to me, but I can’t think of a solution for it, maybe someone can help here.
Also, you must first click on the button "Start a New Discussion"
Example:
5f6a27d985e73918084605.png

I hope you understand my idea. For any advice, links to materials for study I will be grateful!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2020-09-23
@xidios

Install the greasemonkey/tempermonkey extension or any other that allows you to inject (conditionally run) your script onto the page, for debugging you can generally insert the script in the browser console without extensions.
Then the script searches the page for input fields and buttons like this $('#inputbox_id') and gets/sets its content .value or .text (for textbox), press .click() on the button, i.e. all the fuss with the script you should be around not to do these actions immediately after each other (this can be checked to protect against automation in the general case), but at intervals and control over various errors (for example, the form code has changed).
Sometimes just setting the value of the input fields is not enough, you need to simulate keyboard presses, in this case you either generate browser events using keyboardEvent or just peek at what methods are called on these events and call them yourself.
To find out which css selectors the fields you need, in the browser, just press the right mouse button (sometimes with shift) and select inspect element, in the developer tool that opens, you can right-click the necessary page elements and select copy / css selector in the context menu or whatever you please.
It is better to manage your script from the side via http/websocket to your server (you will have to raise the https version if the website also uses it)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question