Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a custom web task #12

Open
jaejaywoo opened this issue Jul 26, 2020 · 1 comment
Open

Adding a custom web task #12

jaejaywoo opened this issue Jul 26, 2020 · 1 comment

Comments

@jaejaywoo
Copy link

Hello!

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

  • Would it be possible to create custom web tasks by adding a new folder under third-party/html using the custom html files (just like how flight tasks are defined)?
  • If so, could you give me some pointers to what needs to be implemented in order for the custom task to be correctly integrated with the current code?
  • Do you think the current javascript codes already implemented (e.g. common/core.js) be reused to define the custom tasks?

Thank you.

@ppasupat
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants