Juna190825 commited on
Commit
9dda435
·
verified ·
1 Parent(s): f9f3393
Files changed (1) hide show
  1. app.py +27 -6
app.py CHANGED
@@ -162,13 +162,34 @@ def setup_selenium():
162
  # timeout=30
163
  # )
164
  service = create_service()
165
-
166
  logger.info("...after: service")
167
- driver = webdriver.Firefox(
168
- options=options,
169
- service=service
170
- # executable_path=os.path.join(os.getcwd(), 'geckodriver')
171
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  logger.info("Selenium driver initialized successfully")
173
  return driver
174
  except Exception as e:
 
162
  # timeout=30
163
  # )
164
  service = create_service()
 
165
  logger.info("...after: service")
166
+
167
+ # driver = webdriver.Firefox(
168
+ # options=options,
169
+ # service=service
170
+ # # executable_path=os.path.join(os.getcwd(), 'geckodriver')
171
+ # )
172
+ try:
173
+ print("Attempting Firefox initialization with:")
174
+ print(f"Service: {service.__dict__}")
175
+ print(f"Options: {options.__dict__}")
176
+
177
+ driver = webdriver.Firefox(
178
+ options=options,
179
+ service=service
180
+ )
181
+ print("Successfully initialized driver!")
182
+
183
+ except Exception as e:
184
+ print(f"Initialization failed completely: {str(e)}")
185
+
186
+ # Last resort - try direct execution
187
+ try:
188
+ from subprocess import run
189
+ run([geckodriver_path, "--version"], check=True)
190
+ run([options.binary_location, "--version"], check=True)
191
+ except Exception as sub_e:
192
+ print(f"Subprocess check failed: {str(sub_e)}")
193
  logger.info("Selenium driver initialized successfully")
194
  return driver
195
  except Exception as e: