Skip to content

Commit 8e2eb30

Browse files
Update README.md. (#95)
* Update README.md. Update README.md to add Playwright select issue to known issues. * Update README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent c0e6049 commit 8e2eb30

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,27 @@ The `main.py` script is the command-line interface (CLI) for running the browser
137137
| GEMINI_API_KEY | Your API key for the Gemini model. | Yes |
138138
| BROWSERBASE_API_KEY | Your API key for Browserbase. | Yes (when using the browserbase environment) |
139139
| BROWSERBASE_PROJECT_ID | Your Project ID for Browserbase. | Yes (when using the browserbase environment) |
140+
141+
## Known Issues
142+
143+
### Playwright Dropdown Menu
144+
145+
On certain operating systems, the Playwright browser is unable to capture `<select>` elements because they are rendered by the operating system. As a result, the agent is unable to send the correct screenshot to the model.
146+
147+
There are several ways to mitigate this.
148+
149+
1. Use the Browserbase option instead of Playwright.
150+
2. Inject a script like [proxy-select](https://github.com/amitamb/proxy-select) to render a custom `<select>` element. You must inject `proxy-select.css` and `proxy-select.js` into each page that has a non-custom `<select>` element. You can do this in the [`Playwright.__enter__`](https://github.com/google-gemini/computer-use-preview/blob/main/computers/playwright/playwright.py#L100) method by adding a few lines of code, like the following (replacing `PROXY_SELECT_JS` and `PROXY_SELECT_CSS` with the appropriate variables):
151+
152+
```python
153+
self._page.add_init_script(PROXY_SELECT_JS)
154+
def inject_style(page):
155+
try:
156+
page.add_style_tag(content=PROXY_SELECT_CSS)
157+
except Exception as e:
158+
print(f"Error injecting style: {e}")
159+
160+
self._page.on('domcontentloaded', inject_style)
161+
```
162+
163+
Note, option 2 does not work 100% of the time, but is a temporary workaround for certain websites. The better option is to use Browserbase.

0 commit comments

Comments
 (0)