I have recently started using remote-browser and when I was working on it, I realized that the documentation is extremely lacking and it took me snooping around the code a lot of time to figure out what's happening.
Towards that effort, I would like to work on the documentation for this project and hence creating this issue so that we can discuss what all needs to be covered. A list of topics off the top of my head are:
- Setting up the browser extension
- How to pass arguments to the
evaluateInContent function and the rationale behind why variables are not closed-over. This one took me quite some time to figure out till I realized that the function is serialized and sent over to the browser. In retrospect, it looks quite obvious, but would be very deterring to new users.
- A troubleshooting guide to wait for document loads. I am not sure how the
evaluator.readyState works, but it didn't work for me. I am using a kind-of hack to wait before proceeding:
function waitFor(browser, tabId, elementLookupList) {
return new Promise(resolve => {
const interval = setInterval(checkForElements, 500);
function checkForElements() {
const allReadyPromise = elementLookupList.map(ele => {
return browser[tabId](ele);
})
Promise.all(allReadyPromise)
.then((elements) => {
if (elements.every(x => x)) {
resolve();
}
})
}
});
}
// USAGE
await waitFor(browser, tabId, [
() => document.getElementById('fldLoginUserId') != null,
() => document.querySelectorAll("input[name='fldSubmit'][value='Continue']").length === 1
]);
- A few more examples of what can be done. I really like the format of the small video you have created to show a live session with a running browser. If the documentation can improve on the process, it would get a lot of people invested very quickly (or so is what I think).
I was thinking of starting with some basic additions to the current README, maybe add more details to each section - especially places where I got stuck and then move on to a caveats guide as well. Before starting, I'll share a quick outline of what I am thinking about the documentation and once we both agree that it looks good, I'll write it out and submit a PR.
Please let me know what else you think can be useful and should be included in the documentation and I'll work on the outline accordingly.
I have recently started using remote-browser and when I was working on it, I realized that the documentation is extremely lacking and it took me snooping around the code a lot of time to figure out what's happening.
Towards that effort, I would like to work on the documentation for this project and hence creating this issue so that we can discuss what all needs to be covered. A list of topics off the top of my head are:
evaluateInContentfunction and the rationale behind why variables are not closed-over. This one took me quite some time to figure out till I realized that the function is serialized and sent over to the browser. In retrospect, it looks quite obvious, but would be very deterring to new users.evaluator.readyStateworks, but it didn't work for me. I am using a kind-of hack to wait before proceeding:I was thinking of starting with some basic additions to the current README, maybe add more details to each section - especially places where I got stuck and then move on to a caveats guide as well. Before starting, I'll share a quick outline of what I am thinking about the documentation and once we both agree that it looks good, I'll write it out and submit a PR.
Please let me know what else you think can be useful and should be included in the documentation and I'll work on the outline accordingly.