fix : change browser waiting check

This commit is contained in:
martin legrand 2025-04-16 10:08:03 +02:00
parent 906dc18060
commit 26421190b1
4 changed files with 11 additions and 13 deletions

View File

@ -58,6 +58,7 @@ services:
- "3000:3000" - "3000:3000"
volumes: volumes:
- ./frontend/agentic-seek/src:/app/src - ./frontend/agentic-seek/src:/app/src
- ./screenshots:/app/screenshots
environment: environment:
- NODE_ENV=development - NODE_ENV=development
- CHOKIDAR_USEPOLLING=true # Ensure file watching works in Docker - CHOKIDAR_USEPOLLING=true # Ensure file watching works in Docker

View File

@ -40,8 +40,7 @@ function App() {
const fetchScreenshot = async () => { const fetchScreenshot = async () => {
try { try {
const res = await axios.get('http://0.0.0.0:8000/screenshots/updated_screen.png', { const res = await axios.get('http://0.0.0.0:8000/screenshots/updated_screen.png', {
responseType: 'blob', responseType: 'blob'
params: { t: new Date().getTime() }
}); });
if (isMounted) { if (isMounted) {
console.log('Screenshot fetched successfully'); console.log('Screenshot fetched successfully');

View File

@ -1,8 +1,9 @@
fastapi==0.115.12 fastapi>=0.115.12
uvicorn==0.34.0 uvicorn>=0.34.0
pydantic==2.10.6 pydantic>=2.10.6
pydantic_core==2.27.2 pydantic_core>=2.27.2
setuptools>=75.6.0 setuptools>=75.6.0
sacremoses>=0.0.53
requests>=2.31.0 requests>=2.31.0
numpy>=1.24.4 numpy>=1.24.4
colorama>=0.4.6 colorama>=0.4.6

View File

@ -153,11 +153,10 @@ class Browser:
try: try:
initial_handles = self.driver.window_handles initial_handles = self.driver.window_handles
self.driver.get(url) self.driver.get(url)
wait = WebDriverWait(self.driver, timeout=30) wait = WebDriverWait(self.driver, timeout=10)
wait.until( wait.until(
lambda driver: ( lambda driver: (
driver.execute_script("return document.readyState") == "complete" and not any(keyword in driver.page_source.lower() for keyword in ["checking your browser", "captcha"])
not any(keyword in driver.page_source.lower() for keyword in ["checking your browser", "verifying", "captcha"])
), ),
message="stuck on 'checking browser' or verification screen" message="stuck on 'checking browser' or verification screen"
) )
@ -591,12 +590,10 @@ if __name__ == "__main__":
driver = create_driver(headless=False, stealth_mode=True) driver = create_driver(headless=False, stealth_mode=True)
browser = Browser(driver, anticaptcha_manual_install=True) browser = Browser(driver, anticaptcha_manual_install=True)
#browser.go_to("https://github.com/Fosowl/agenticSeek")
#txt = browser.get_text()
#print(txt)
#browser.go_to("https://practicetestautomation.com/practice-test-login/")
input("press enter to continue") input("press enter to continue")
print("AntiCaptcha / Form Test") print("AntiCaptcha / Form Test")
#browser.go_to("https://practicetestautomation.com/practice-test-login/")
#txt = browser.get_text()
#browser.go_to("https://www.google.com/recaptcha/api2/demo") #browser.go_to("https://www.google.com/recaptcha/api2/demo")
browser.go_to("https://home.openweathermap.org/users/sign_up") browser.go_to("https://home.openweathermap.org/users/sign_up")
inputs_visible = browser.get_form_inputs() inputs_visible = browser.get_form_inputs()