i am quit new to webscraping, i am building a personal app with python on debian buster and firefox geckodriver as follow, the server is online
firefox_binary = FirefoxBinary('/usr/bin/firefox')
opts = FirefoxOptions()
opts.add_argument("--headless")
driver = webdriver.Firefox(options=opts, firefox_binary=firefox_binary)
driver.get(url)
i aim to triggered this app by a ajax call in a web page, it's a nginx server so the py script is called in a php exec command :
exec ('/usr/bin/python3 webdriver.py');
it works fine in command line in debian if i am logged in root or another user. when i call the script using web interface, the user is www-data and i encounter this error : connection refused (os error 111)
i ve been searching for 3 days in all internet sources i can find and tried all i could, i haven't any solution for now
would you have any idea of the way to solve this issue?
Edit :
selenium version 3.141.0
Mozilla Firefox 78.8.0esr
geckodriver 0.29
geckodriver.log for www-data user (with error):
- 1614703595351 geckodriver INFO Listening on 127.0.0.1:53899
- 1614703595556 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile22XajP"
- *** You are running in headless mode.
geckodriver.log for for admin (without error) :
- 1614702846828 geckodriver INFO Listening on 127.0.0.1:46897
- 1614702847019 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile7jTA4y"
- *** You are running in headless mode.
- 1614702859057 Marionette INFO Listening on port 45145
- 1614702859109 Marionette WARN TLS certificate errors will be ignored for this session
- JavaScript warning: https://..........................js?v=1.2.7199.0, line 119: unreachable code after return statement
- JavaScript warning: https://..........................js?v=1.2.7199.0, line 119: unreachable code after return statement
- 1614702872140 Marionette WARN TimedPromise timed out after 500 ms: stacktrace:
- TimedPromise/<@chrome://marionette/content/sync.js:245:13
- TimedPromise@chrome://marionette/content/sync.js:230:10
- Interaction.flushEventLoop@chrome://marionette/content/interaction.js:416:10 webdriverClickElement@chrome://marionette/content/interaction.js:182:31
- 1614702900530 Marionette INFO Stopped listening on port 45145
geckodriver.log for www-data with geckodriver 0.21 :
1614706982655 geckodriver INFO geckodriver 0.21.0
1614706982680 geckodriver INFO Listening on 127.0.0.1:33947
1614706983553 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.p37a7r0syAmR"
*** You are running in headless mode.
(firefox-esr:22409): dconf-CRITICAL **: 17:44:03.845: unable to create directory '/var/www/.cache/dconf': Permission denied. dconf will not work properly.