stanfordnlp / wge

Workflow-Guided Exploration: sample-efficient RL agent for web tasks
https://stanfordnlp.github.io/wge/
Other
108 stars 33 forks source link

Adding a custom web task #12

Open jaejaywoo opened 4 years ago

jaejaywoo commented 4 years ago

Hello!

First of all, thank you for sharing your codes! I just have a few question regarding adding and creating a new web tasks:

Thank you.

ppasupat commented 4 years ago

Hi! For a small-scale task, just add an HTML file to the directory third-party/miniwob-sandbox/html/miniwob/. Copy a code skeleton from another task (e.g., click_checkboxes.html) and change the genProblem method, which will be called at the beginning of each episode.

The method core.endEpisode(reward) should be called when the episode ends before the time runs out (e.g., in the event listener of the Submit button). There are a few other utilities such as random number generator in common/core.js.

See the README on how to test the task. The README of https://github.com/stanfordnlp/miniwob-plusplus contains a bit more details about utilities in core.js.

On the Python side, specifying --task=<taskname> to main.py should be enough. To specify custom configs for the task, add a config file to configs/task-mixins/.

For larger-scale tasks like the flight tasks, the system is a bit more complex. The file Alaska/wrapper.html is the main task page, which contains an iframe that will show Alaska/index.html. The genProblem method is located in flight-common/wrapper.js. The index.html was ripped from the Alaska Airlines website, with the form having an extra class miniwob-main-form and the JS file flight-common/inject.js added. The endEpisode within the iframe (index.html) relays the call to the parent frame (wrapper.html).

Feel free to reply to this thread if there are further questions.