rebremer / azure-function-selenium Goto Github PK
View Code? Open in Web Editor NEWAzure Function running selenium webdriver using a custom docker image
Azure Function running selenium webdriver using a custom docker image
Thank you so much for sharing your work.
With some adjustments I was able to successfully replicate your setup and use the http_trigger to crawl http://www.ubuntu.com/. However, I have some issues trying to adjust the script. How would you go about changing the code from HttpTrigger \ init.py ?
I tried,
docker build --tag $acr_id/selenium .
docker push $acr_id/selenium:latest
az functionapp delete (current app)
This procedure takes quite a lot of time, especially when trying to debug the code changes. Since I'm pretty new to docker and azure, I'm pretty sure this isn't the most effective way to adjust/debug/update the system. If you could provide any assistance, that'd be greatly appreciated.
Thank you!
If possible then plz help me with the code. It will be very helpful.
I have followed all the steps which you have described but I got the error which i don't understand
Here is the whole error
Function.MadridCrawlHTTPTrigger[3]
Executed 'Functions.MadridCrawlHTTPTrigger' (Failed, Id=33e192ec-956b-4bde-a629-16bf2040eb99, Duration=3148ms)
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.MadridCrawlHTTPTrigger
---> Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Result: Failure
Exception: WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x5572e95882a3
#1 0x5572e9346f77
#2 0x5572e936f5f7
#3 0x5572e936b7d0
#4 0x5572e93ac0b7
#5 0x5572e93aba5f
#6 0x5572e93a3903
#7 0x5572e9376ece
#8 0x5572e9377fde
#9 0x5572e95d863e
#10 0x5572e95dbb79
#11 0x5572e95be89e
#12 0x5572e95dca83
#13 0x5572e95b1505
#14 0x5572e95fdca8
#15 0x5572e95fde36
#16 0x5572e9619333
#17 0x7f95e9361ea7 start_thread
Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 458, in _handle__invocation_request
call_result = await self._loop.run_in_executor(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 701, in _run_sync_func
return ExtensionManager.get_sync_invocation_wrapper(context,
File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/extension.py", line 215, in _raw_invocation_wrapper
result = function(**args)
File "/home/site/wwwroot/function_app.py", line 168, in selenium_function
madridcrawler = MadridCrawler(conn)
File "/home/site/wwwroot/src/madrid_updater.py", line 61, in __init__
self.driver = webdriver.Chrome(options= options, service=Service(ChromeDriverManager().install()))
Please help me out
Thank You
I have followed all the steps which you have described but I got the error which i dont understand
Here is the whole error
Result: Failure Exception: TypeError: expected str, bytes or os.PathLike object, not Service Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 407, in _handle__invocation_request call_result = await self._loop.run_in_executor( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 649, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/extension.py", line 215, in _raw_invocation_wrapper result = function(**args) File "/home/site/wwwroot/trail_cx3/init.py", line 37, in main driver = webdriver.Chrome(service, options=chrome_options) File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in init super().init(DesiredCapabilities.CHROME['browserName'], "goog", File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in init self.service.start() File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 71, in start self.process = subprocess.Popen(cmd, env=self.env, File "/usr/local/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.9/subprocess.py", line 1696, in _execute_child and os.path.dirname(executable) File "/usr/local/lib/python3.9/posixpath.py", line 152, in dirname p = os.fspath(p)
Please help me out
Thank You
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.