Skip to content

Commit 7dde45a

Browse files
committed
remove selenium in favor of Browser Use
1 parent 285c18c commit 7dde45a

10 files changed

Lines changed: 3 additions & 134 deletions

File tree

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ check-poetry:
210210
fi; \
211211
fi
212212

213-
sel:
214-
@echo "$(YELLOW)Starting Selenium...$(RESET)"
215-
@python -i openhands/sel/selenium_browser.py
216-
217213
install-python-dependencies:
218214
@export DEBIAN_FRONTEND=noninteractive
219215
@echo "$(GREEN)Installing Python dependencies...$(RESET)"

openhands/runtime/impl/docker/docker_runtime.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,6 @@ async def connect(self):
247247
if not self.attach_to_existing:
248248
self.send_status_message(' ')
249249
self._runtime_initialized = True
250-
if os.environ.get('USE_SELENIUM'):
251-
try:
252-
path = 'openhands/sel/selenium_session_details.py'
253-
self.copy_to(path, '/openhands/code/openhands/sel/')
254-
path = 'openhands/sel/selenium_tester.py'
255-
self.copy_to(path, '/openhands/code/openhands/sel/')
256-
logger.debug('Copied selenium files to runtime')
257-
except Exception as e:
258-
logger.error(f'Error copying selenium files to runtime: {e}')
259-
try:
260-
self.copy_to('sandbox.env', '/openhands/code')
261-
except Exception as e:
262-
# logger.error(f'Error copying sandbox.env to runtime: {e}')
263-
pass
264250

265251
@staticmethod
266252
@lru_cache(maxsize=1)

openhands/runtime/plugins/agent_skills/agentskills.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,4 @@
3030
# # Add file_editor (a function)
3131
# from openhands.runtime.plugins.agent_skills.file_editor import file_editor # noqa: E402
3232

33-
# __all__ += ['file_editor']
34-
if os.environ.get('USE_SELENIUM'):
35-
from openhands.sel.selenium_tester import driver, create_driver
36-
def dss():
37-
'''
38-
Alias to driver.get_screenshot_as_png()
39-
'''
40-
return driver.get_screenshot_as_png()
41-
42-
__all__ += ['driver', 'dss', 'create_driver']
33+
# __all__ += ['file_editor']

openhands/runtime/plugins/agent_skills/file_ops/academic_utils/utils.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
import requests
66
from fuzzywuzzy import fuzz
77
from scholarly import scholarly
8-
from selenium.webdriver.common.by import By
9-
from selenium.webdriver.support import expected_conditions as EC
10-
from selenium.webdriver.support.ui import WebDriverWait
118
from semanticscholar import SemanticScholar
129

13-
from openhands.sel.selenium_tester import driver
1410

1511

1612
def clean_filename(filename: str):
@@ -89,25 +85,7 @@ def download_semantic_scholar_pdf(query: str | None = None, url: str | None = No
8985
print('No results found')
9086
return
9187
url = results[0].url
92-
driver.get(url)
93-
try:
94-
s = '[data-test-id="cookie-banner__dismiss-btn"]'
95-
WebDriverWait(driver, 10).until(
96-
EC.element_to_be_clickable((By.CSS_SELECTOR, s))
97-
).click()
98-
except Exception as e:
99-
print(f'Error: {e}')
100-
s = '[data-test-id="icon-disclosure"]'
101-
WebDriverWait(driver, 10).until(
102-
EC.element_to_be_clickable((By.CSS_SELECTOR, s))
103-
).click()
104-
s = '[data-test-id="paper-link"]'
105-
link = driver.find_element(By.CSS_SELECTOR, s).get_attribute('href')
106-
if 'arxiv' in link:
107-
print(f'Downloading from {link}')
108-
download_pdf_from_url(link)
109-
else:
110-
print(f'Download from {link}')
88+
print('Use Browser Use')
11189

11290

11391
def download_google_scholar_paper(search_query: str):

openhands/sel/README.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

openhands/sel/selenium_browser.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

openhands/sel/selenium_session_details.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

openhands/sel/selenium_tester.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

requirements-extra.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ python-Levenshtein
22
fuzzywuzzy
33
arxiv
44
libcst
5-
seleniumbase>=4.33.12
65
scholarly>=1.7.11
76
langchain_google_genai==2.1.1
87
browser-use==0.1.40
98
itsdangerous==2.2.0
109
diskcache==5.6.3
11-
# PyPaperBot>=1.4.1
12-
# seleniumbase 4.33.12 depends on beautifulsoup4==4.12.3
13-
# pypaperbot 1.0 depends on beautifulsoup4==4.9.1
10+
# PyPaperBot>=1.4.1

upd_persistent_container.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
'openhands/runtime/utils/bash_pexpect.py',
1818
'openhands/runtime/action_execution_server.py',
1919
'openhands/linter/__init__.py',
20-
'openhands/sel/selenium_tester.py',
21-
'openhands/sel/selenium_session_details.py',
2220
'openhands/events/event.py',
2321
'sandbox.env'
2422
]

0 commit comments

Comments
 (0)