• <bdo id='qLPgS'></bdo><ul id='qLPgS'></ul>

  • <tfoot id='qLPgS'></tfoot>

      <legend id='qLPgS'><style id='qLPgS'><dir id='qLPgS'><q id='qLPgS'></q></dir></style></legend>

      1. <small id='qLPgS'></small><noframes id='qLPgS'>

      2. <i id='qLPgS'><tr id='qLPgS'><dt id='qLPgS'><q id='qLPgS'><span id='qLPgS'><b id='qLPgS'><form id='qLPgS'><ins id='qLPgS'></ins><ul id='qLPgS'></ul><sub id='qLPgS'></sub></form><legend id='qLPgS'></legend><bdo id='qLPgS'><pre id='qLPgS'><center id='qLPgS'></center></pre></bdo></b><th id='qLPgS'></th></span></q></dt></tr></i><div id='qLPgS'><tfoot id='qLPgS'></tfoot><dl id='qLPgS'><fieldset id='qLPgS'></fieldset></dl></div>

        使用 Selenium WebDriver.dll 的 Azure 函数

        时间:2023-10-25

          <bdo id='LXkM1'></bdo><ul id='LXkM1'></ul>

              <tbody id='LXkM1'></tbody>
              <i id='LXkM1'><tr id='LXkM1'><dt id='LXkM1'><q id='LXkM1'><span id='LXkM1'><b id='LXkM1'><form id='LXkM1'><ins id='LXkM1'></ins><ul id='LXkM1'></ul><sub id='LXkM1'></sub></form><legend id='LXkM1'></legend><bdo id='LXkM1'><pre id='LXkM1'><center id='LXkM1'></center></pre></bdo></b><th id='LXkM1'></th></span></q></dt></tr></i><div id='LXkM1'><tfoot id='LXkM1'></tfoot><dl id='LXkM1'><fieldset id='LXkM1'></fieldset></dl></div>
                <legend id='LXkM1'><style id='LXkM1'><dir id='LXkM1'><q id='LXkM1'></q></dir></style></legend>
                <tfoot id='LXkM1'></tfoot>

                <small id='LXkM1'></small><noframes id='LXkM1'>

                1. 本文介绍了使用 Selenium WebDriver.dll 的 Azure 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 Azure Function C# 代码中的 Selenium WebDriver.dll 并在实例化 WebDriver 时遇到以下问题.

                  i am trying to use Selenium WebDriver.dll from Azure Function C# code and having following issue when instantiating WebDriver.

                  错误:

                  2017-10-16T20:02:25.169 执行函数时出现异常:Functions.fnTestSelenium.Microsoft.Azure.WebJobs.Script:出现一个或多个错误.mscorlib:路径不是合法形式.2017-10-16T20:02:25.278 功能完成(失败,Id=2fcb928f-ee39-4cfe-99f2-4be2d57e91b2,持续时间=843ms)

                  2017-10-16T20:02:25.169 Exception while executing function: Functions.fnTestSelenium. Microsoft.Azure.WebJobs.Script: One or more errors occurred. mscorlib: The path is not of a legal form.2017-10-16T20:02:25.278 Function completed (Failure, Id=2fcb928f-ee39-4cfe-99f2-4be2d57e91b2, Duration=843ms)

                  代码

                  #r "D:homesitewwwrootfnTestSeleniuminWebDriver.dll"使用 System.Net;

                  #r "D:homesitewwwrootfnTestSeleniuminWebDriver.dll" using System.Net;

                  using OpenQA.Selenium;
                  using OpenQA.Selenium.Firefox;
                  
                  public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
                  {
                      log.Info("C# HTTP trigger function processed a request.");
                  
                      IWebDriver driver=new FirefoxDriver();
                      // parse query parameter
                      string name = req.GetQueryNameValuePairs()
                          .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
                          .Value;
                  
                      // Get request body
                      dynamic data = await req.Content.ReadAsAsync<object>();
                  
                      // Set name to query string or body data
                      name = name ?? data?.name;
                  
                      return name == null
                          ? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")
                          : req.CreateResponse(HttpStatusCode.OK, "Hello " + name);
                  }
                  

                  推荐答案

                  我认为在 Azure Functions 上运行 Selenium 不会有太大的成功.

                  I don't think you'll have much success running Selenium on Azure Functions.

                  Azure Functions,如 WebApp 和移动应用,在应用服务中运行.应用服务在称为沙盒的安全环境中运行,该环境具有一定的限制.其中,就是使用GDI+.

                  Azure Functions, like WebApps and Mobile Apps, run in an App Service. The App Service runs in a secure environment called a sandbox which imposes certain limitation. Amongst them, is the use of GDI+.

                  您可以查看限制列表以及不支持的框架列表 https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks

                  You can see the list of limitation, along with the list of unsupported frameworks https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks

                  如果你往底部检查,你会在不支持的列表中看到 Selenimum:

                  If you check towards the bottom, you will see Selenimum in the list of unsupported:

                  其他不支持的场景:

                  PhantomJS/Selenium:尝试连接到本地地址,也使用GDI+.

                  PhantomJS/Selenium: tries to connect to local address, and also uses GDI+.

                  这篇关于使用 Selenium WebDriver.dll 的 Azure 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何识别用于调用 Azure 函数的 HTTP 方法(动词) 下一篇:为什么 Azure Function v2 无法绑定到 CloudTable?

                  相关文章

                2. <tfoot id='4RLa0'></tfoot>
                  • <bdo id='4RLa0'></bdo><ul id='4RLa0'></ul>

                  <small id='4RLa0'></small><noframes id='4RLa0'>

                3. <i id='4RLa0'><tr id='4RLa0'><dt id='4RLa0'><q id='4RLa0'><span id='4RLa0'><b id='4RLa0'><form id='4RLa0'><ins id='4RLa0'></ins><ul id='4RLa0'></ul><sub id='4RLa0'></sub></form><legend id='4RLa0'></legend><bdo id='4RLa0'><pre id='4RLa0'><center id='4RLa0'></center></pre></bdo></b><th id='4RLa0'></th></span></q></dt></tr></i><div id='4RLa0'><tfoot id='4RLa0'></tfoot><dl id='4RLa0'><fieldset id='4RLa0'></fieldset></dl></div>

                    1. <legend id='4RLa0'><style id='4RLa0'><dir id='4RLa0'><q id='4RLa0'></q></dir></style></legend>