Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
liqul committed Jan 18, 2024
1 parent 6f5211a commit bda58c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions project/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ In this plugin, we use Selenium driver to open a web browser and navigate to a w
So, you need to install the following python packages:
```bash
pip install selenium
pip install pillow
```

We use the Chrome driver in this example. You can download the driver from [here](https://chromedriver.chromium.org/downloads).
Expand Down
15 changes: 8 additions & 7 deletions project/plugins/vision_web_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
from typing import Any, Dict, List, Tuple

import requests
from PIL import Image

from taskweaver.plugin import Plugin, register_plugin

try:
from PIL import Image
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
Expand All @@ -19,6 +17,7 @@
except ImportError:
raise ImportError("Please install selenium first.")

from taskweaver.plugin import Plugin, register_plugin
from taskweaver.plugin.context import PluginContext


Expand Down Expand Up @@ -216,10 +215,12 @@ def extract_basic_info(el):
print(e)

remove_labels_script = """
var labels = document.querySelectorAll('div[label-element-number]');
labels.forEach(function(label) {
label.parentNode.removeChild(label);
});
(function() {
var labels = document.querySelectorAll('div[label-element-number]');
labels.forEach(function(label) {
label.parentNode.removeChild(label);
});
})();
"""
self.driver.execute_script(remove_labels_script)

Expand Down
4 changes: 2 additions & 2 deletions project/plugins/vision_web_explorer.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: vision_web_explorer
enabled: false
enabled: true
required: false
plugin_only: true
description: >-
Expand Down Expand Up @@ -38,4 +38,4 @@ returns:
configurations:
endpoint:
api_key:
driver_path:
driver_path:

0 comments on commit bda58c2

Please sign in to comment.