在 Windows 上通过 Jenkins 使用 chromedriver 和 chrome 捕获屏幕截图时,从渲染器接收消息超时:10.000

2024-01-04

操作系统:Windows 10 浏览器:Chrome 浏览器版本:版本73.0.3683.86(官方版本)(32位)

我正在运行 selenium cucumber BDD 项目,我正在验证一页的标题。我正在使用范围报告版本4。项目在本地运行成功。但是当我通过 Jenkins 运行它时,它在捕获屏幕截图并显示以下错误时失败。

如果我从 pom.xml 中删除 Surefire 插件,则测试不会通过 Jenkins 运行。

在 Jenkins 的执行 Windows 批处理命令选项中,我给出了以下命令

C:\Program Files (x86)\Jenkins\workspace\CucumberBDDFramework
mvn test

测试运行者

    package com.accenture.TestRunner;

    import org.testng.annotations.AfterClass;
    import org.testng.annotations.Test;
    import org.testng.annotations.BeforeClass;
    import org.testng.annotations.AfterClass;
    import org.testng.annotations.BeforeClass;
    import org.testng.annotations.DataProvider;
    import org.testng.annotations.Test;

    import cucumber.api.CucumberOptions;
    import cucumber.api.testng.AbstractTestNGCucumberTests;
    import cucumber.api.testng.CucumberFeatureWrapper;
    import cucumber.api.testng.TestNGCucumberRunner;


    /**
     * @author ajinkya.pande
     *
     */

    @CucumberOptions(
            features="./features/WhatIsBitcoin.feature",
            glue= {"com.accenture.StepDef"},
            tags= {"@ExtentReport"}, 
            dryRun = false
            )

    public class TestRunner {

        // Write following steps or Try to extend AbstractTestNGCucumberTests

        private TestNGCucumberRunner testNGCucumberRunner;

        @BeforeClass(alwaysRun = true)
        public void setUpClass() throws Exception{ 
            testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
        }

        @Test(dataProvider = "features")
        public void feature(CucumberFeatureWrapper cucumberFeature) {
            testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
        }

        @DataProvider
        public Object [][] features(){
            return testNGCucumberRunner.provideFeatures();
        }


        @AfterClass(alwaysRun = true)
        public void tearDownClass() throws Exception{
            testNGCucumberRunner.finish();
        }

    }

步骤定义

    package com.accenture.listeners;

    import java.io.File;
    import java.io.IOException;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Date;

    import org.apache.commons.io.FileUtils;
    import org.openqa.selenium.OutputType;
    import org.openqa.selenium.TakesScreenshot;
    import org.openqa.selenium.WebDriver;

    import com.accenture.Utility.Constants;
    import com.aventstack.extentreports.ExtentReports;
    import com.aventstack.extentreports.ExtentTest;
    import com.aventstack.extentreports.markuputils.ExtentColor;
    import com.aventstack.extentreports.markuputils.MarkupHelper;
    import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
    import com.aventstack.extentreports.reporter.configuration.Theme;

    /**
     * @author ajinkya.pande
     *
     */

    public class ExtentReportListener extends Constants {

        public static ExtentHtmlReporter report = null;
        public static ExtentReports extent = null;
        public static ExtentTest test = null;

        public static ExtentReports setUp() {
            String reportLocation = "./Reports/Extent_Report.html";
            report = new ExtentHtmlReporter(reportLocation);
            report.config().setDocumentTitle("Automation Test Report");
            report.config().setReportName("Automation Test Report");
            report.config().setTheme(Theme.STANDARD);
            System.out.println("Extent Report location initialized . . .");
            report.start();

            extent = new ExtentReports();
            extent.attachReporter(report);
            extent.setSystemInfo("Application", "Youtube");
            extent.setSystemInfo("Operating System", System.getProperty("os.name"));
            extent.setSystemInfo("User Name", System.getProperty("user.name"));
            System.out.println("System Info. set in Extent Report");
            return extent;
        }

        public static void testStepHandle(String teststatus, WebDriver driver, ExtentTest extenttest, Throwable throwable) {
            if (teststatus.equals("FAIL")) {

                extenttest.fail(MarkupHelper.createLabel("Test Case is Failed : ", ExtentColor.RED));
                extenttest.error(throwable.fillInStackTrace());

                try {
                    extenttest.addScreenCaptureFromPath(captureScreenShot(driver));
                } catch (IOException e) {
                    e.printStackTrace();
                }

                if (driver != null) {
                    driver.quit();
                }

                if (teststatus.equals("PASS")) {
                    extenttest.pass(MarkupHelper.createLabel("Test Case is Passed : ", ExtentColor.GREEN));
                    try {
                        extenttest.addScreenCaptureFromPath(captureScreenShot(driver));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

            }
        }

        public static String captureScreenShot(WebDriver driver) throws IOException {
            TakesScreenshot screen = (TakesScreenshot) driver;
            File src = screen.getScreenshotAs(OutputType.FILE);
            String dest = SCRRENSHOT_PATH + getcurrentdateandtime() + ".png";
            File target = new File(dest);
            FileUtils.copyFile(src, target);
            return dest;
        }

        private static String getcurrentdateandtime() {
            String str = null;
            try {
                DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss:SSS");
                Date date = new Date();
                str = dateFormat.format(date);
                str = str.replace(" ", "").replaceAll("/", "").replaceAll(":", "");
            } catch (Exception e) {
            }
            return str;
        }

    }

pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.ajinkya.cucumber</groupId>
      <artifactId>extent-reporting</artifactId>
      <version>0.0.1-SNAPSHOT</version>



       <build>
        <plugins>


    <!--       <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
             <version>3.7.0</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin> -->


          <plugin>
             <artifactId>maven-compiler-plugin</artifactId>
             <version>3.1</version>
            <configuration>
              <fork>1.7</fork>
              <executable>C:\Program Files\Java\jdk1.8.0_191\bin\javac.exe</executable>
            </configuration>
          </plugin>


       <!--    <plugin>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>3.15.0</version>
        <executions>
            <execution>
                <id>execute</id>
                <phase>verify</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                    <cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
                </configuration>
            </execution>            
        </executions>
          </plugin> -->


           <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.19.1</version>
              <configuration>
                <suiteXmlFiles>testng.xml</suiteXmlFiles>
              </configuration>
            </plugin>


        </plugins>
      </build>












      <dependencies>

      <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.11.0</version>
    </dependency>



      <dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.5</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-testng -->
    <dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-testng</artifactId>
    <version>1.2.5</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.8</version>
    </dependency>


      <dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-jvm-deps</artifactId>
    <version>1.0.5</version>
    <scope>provided</scope>
    </dependency>

    <dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.6</version>
    </dependency>

    <dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker</artifactId>
    <version>2.3.23</version>
    </dependency>

      <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>


      </dependencies>



    </project>

詹金斯日志:


     T E S T S
    -------------------------------------------------------
    Running TestSuite
    Starting...............
    Extent Report location initialized . . .
    System Info. set in Extent Report
    Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 8950
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
    Mar 26, 2019 11:15:27 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: OSS
    [1553622354.306][SEVERE]: Timed out receiving message from renderer: 10.000
    [1553622354.307][WARNING]: screenshot failed, retrying
    [1553622364.313][SEVERE]: Timed out receiving message from renderer: 9.996
    [1553622374.336][SEVERE]: Timed out receiving message from renderer: 9.998
    [1553622374.337][WARNING]: screenshot failed, retrying
    [1553622384.337][SEVERE]: Timed out receiving message from renderer: 9.998
    [1553622394.343][SEVERE]: Timed out receiving message from renderer: 10.000
    [1553622394.344][WARNING]: screenshot failed, retrying
    [1553622404.345][SEVERE]: Timed out receiving message from renderer: 9.996

    Failed scenarios:
    ./features/WhatIsBitcoin.feature:3 # Scenario: Testing extent reports

    1 Scenarios (1 failed)
    4 Steps (1 failed, 3 skipped)
    1m25.069s

    org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 9.996
      (Session info: chrome=73.0.3683.86)
      (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 0 milliseconds
    Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
    System info: host: 'BDC11-L-FYK3VP2', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 73.0.3683.68 (47787ec04b6e3..., userDataDir: C:\windows\TEMP\scoped_dir1...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:51833}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 73.0.3683.86, webStorageEnabled: true}
    Session ID: 1b4d8402a8e29651ed2c7a773c11ca37
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
        at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
        at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
        at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
        at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:291)
        at com.accenture.listeners.ExtentReportListener.captureScreenShot(ExtentReportListener.java:81)
        at com.accenture.StepDef.WhatIsBitcoin.go_to_chrome(WhatIsBitcoin.java:47)
        at ?.When Go to chrome(./features/WhatIsBitcoin.feature:4)

    Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 86.657 sec <<< FAILURE! - in TestSuite
    feature(com.accenture.TestRunner.TestRunner)  Time elapsed: 85.109 sec  <<< FAILURE!
    cucumber.runtime.CucumberException: 
    org.openqa.selenium.TimeoutException: timeout: Timed out receiving message from renderer: 9.996
      (Session info: chrome=73.0.3683.86)
      (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 0 milliseconds
    Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
    System info: host: 'BDC11-L-FYK3VP2', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 73.0.3683.68 (47787ec04b6e3..., userDataDir: C:\windows\TEMP\scoped_dir1...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:51833}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 73.0.3683.86, webStorageEnabled: true}
    Session ID: 1b4d8402a8e29651ed2c7a773c11ca37
        at com.accenture.TestRunner.TestRunner.feature(TestRunner.java:42)
    Caused by: org.openqa.selenium.TimeoutException: 
    timeout: Timed out receiving message from renderer: 9.996
      (Session info: chrome=73.0.3683.86)
      (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 0 milliseconds
    Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
    System info: host: 'BDC11-L-FYK3VP2', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 73.0.3683.68 (47787ec04b6e3..., userDataDir: C:\windows\TEMP\scoped_dir1...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:51833}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), rotatable: false, setWindowRect: true, strictFileInteractability: false, takesHeapSnapshot: true, takesScreenshot: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unexpectedAlertBehaviour: ignore, unhandledPromptBehavior: ignore, version: 73.0.3683.86, webStorageEnabled: true}
    Session ID: 1b4d8402a8e29651ed2c7a773c11ca37


    Results :

    Failed tests: 
      TestRunner.feature:42 » Cucumber org.openqa.selenium.TimeoutException: timeout...

    Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  01:33 min
    [INFO] Finished at: 2019-03-26T23:16:45+05:30
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project extent-reporting: There are test failures.
    [ERROR] 
    [ERROR] Please refer to C:\Program Files (x86)\Jenkins\workspace\CucumberBDDFramework\target\surefire-reports for the individual test results.
    [ERROR] -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    Build step 'Execute Windows batch command' marked build as failure
    Finished: FAILURE

看来你正在使用chromedriver=73.0.3683.68 and 铬=73.0.3683.86 on Windows操作系统

John Chen(所有者 - chromedriver)最近证实:

我们已确认,当 Windows 上的服务(例如 Jenkins 或任务计划程序)启动 Chrome 73.0.3686.75 时,屏幕截图会出现问题。请参见https://crbug.com/942023 https://crbug.com/942023更多细节。对于由此造成的任何不便,我们深表歉意。

但是,我们尚未能够在 Linux 上观察到类似的问题,因此我们感谢您提供的任何帮助,使我们能够在 Linux 上重现该问题。我们无法访问 TeamCity,但我们已经测试使用 Selenium (selenium/standalone-chrome:3.141.59-lithium) 生成的 Docker 映像进行屏幕截图,并且没有发现任何问题。


Update

我们能够挖掘出主要问题。主要问题不在于Chrome 驱动程序 v73.x如此但与Chrome v73.x约翰正式确认为:

根本原因确实是在 Chrome 73.x 中,而不是在 ChromeDriver 中。我们正在与 Chrome 开发人员合作寻找解决方案。


Solution

解决方案是:

  • 降级Chrome浏览器 to Chrome v72.x
  • Use a matching ChromeDriver among:
    • Chrome 驱动程序 2.46 https://chromedriver.storage.googleapis.com/index.html?path=2.46/
    • Chrome驱动程序72.0.3626.69 https://chromedriver.storage.googleapis.com/index.html?path=72.0.3626.69/

注意:如果您使用的是 Chrome 版本 72,请下载 ChromeDriver 2.46 或 ChromeDriver 72.0.3626.69


Outro

  • 讨论:Page.captureScreenshot 不再在 Windows 上的 Selenium 即服务下的 Chrome 73 中工作 https://bugs.chromium.org/p/chromium/issues/detail?id=942023
  • 提交导致问题的信息:设置在桌面平台上启用 VizDisplayCompositor 功能 https://chromium.googlesource.com/chromium/src/+/73a59e05c556d9bf3f9ac16dfc5f11862f08ab4b
  • Merge: 延迟:从 LatencyInfo 中删除快照 https://chromium-review.googlesource.com/c/chromium/src/+/1095562
  • 下载适用于所有操作系统的 Google Chrome 72 离线安装程序 https://www.itechtics.com/download-google-chrome-72-offline-installer-for-all-operating-systems/

更新(2019 年 4 月 3 日)

添加参数--disable-features=VizDisplayCompositor通过一个实例ChromeOptions()似乎解决了这个问题:

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-features=VizDisplayCompositor");
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Windows 上通过 Jenkins 使用 chromedriver 和 chrome 捕获屏幕截图时,从渲染器接收消息超时:10.000 的相关文章

  • 通过 CLI 标志在隐身模式下启用 Chrome 扩展?

    我正在使用 selenium 来测试 chrome 扩展 部分扩展要求用户处于隐身模式 目前 除了添加参数之外 我还无法在启动时允许扩展程序处于隐身模式user data dir path to directory 这样做的问题是 它从我的
  • C++串口问题

    我在 Visual Studio 上使用 C 连接到任何串行端口 想要与 Arduino 交换 时遇到问题 我正在使用串行类 http www arduino cc playground Interfacing CPPWindows在 Ar
  • Windows下Kafka托管在Docker中删除主题时出现异常

    我在 Windows 的 Docker 中托管 Kafka 威斯迈斯特 卡夫卡 https hub docker com r wurstmeister kafka 使用 docker 镜像 Kafka 数据存储在本地 Windows 文件夹
  • Chrome 扩展程序不会从弹出文件加载我的 JavaScript

    我正在为论坛构建 Chrome 扩展程序 但问题是我的 popup html 的 JavaScript 不会执行任何操作 我在顶部添加了警报 popup js running 它确实出现了 但我的弹出窗口根本不显示 这是一个问题 因为弹出页
  • 在新窗口中打开 SAS 程序

    目前 当您在 Windows 中双击 SAS 文件时 它将在您已打开的现有 SAS 会话中打开它 有没有办法让它在窗口中单击时会启动一个新的 SAS 窗口 据我所知 SAS 是一个所谓的 单实例 应用程序 因此它的默认行为是在现有会话中打开
  • 在 Windows 11 上无需管理员权限即可运行 Visual Studio 2022

    我在 Windows 11 上安装了 Visual Studio 2022 当我启动它时 它始终以管理员权限运行 我想在没有管理员权限的情况下运行它 我的 Windows 只有一个帐户 该帐户具有管理员权限 x 我做了什么 确认VS2022
  • 为什么我们从 MultiByte 转换为 WideChar?

    我习惯于处理 ASCII 字符串 但现在使用 UNICODE 我对一些术语感到非常困惑 什么是多字节字符以及什么是widechar有什么不同 多字节是指在内存中包含多个字节的字符吗 widechar只是一个数据类型来表示吗 为什么我们要从M
  • 在 Chrome/Safari 中添加 html5 属性后 Ajax 表单中断

    分步说明 新建 Asp Net MVC2 项目 Model public class TestModel public int Property get set 家庭控制器 HandleError public class HomeCont
  • 为什么我必须点击两次才能使用 selenium 提交输入

    ENV 铬 32 webdriver2 8 我正在使用 selenium java 单击提交输入 但我需要单击两次才能激活提交操作 输入代码
  • 如何获取由 chrome.windows.create() 创建的弹出窗口的窗口 ID

    如何获取由 chrome windows create 创建的弹出窗口的 window id 背景 html window options url another popup html type popup chrome windows c
  • 使用 Selenium 在选项卡之间切换并对个人执行操作

    我正在尝试提取 URL 将其打开到新选项卡中 然后执行一些操作 我的代码是 urls self driver find elements by xpath div id maincontent table tbody tr td a hre
  • Chrome DevTools:计算样式与 css 规则不同?

    当我在 CSS 文件中定义 4px 时 我的 DOM 元素的 border top width 怎么可能是 0px 当我使用 Chrome DevTools 检查元素时 我发现计算的样式告诉 0px 而最上面的 css 规则是 4px 而且
  • 导入错误:无法导入名称线程

    这是我第一次学习Python 我继续尝试线程这篇博文 http www saltycrane com blog 2008 09 simplistic python thread example 问题是它似乎已经过时了 import time
  • 如何更改选项卡控件的名称

    我在 C WinForms 应用程序中使用选项卡控件 我想更改选项卡的标题 默认情况下它们是 tabPage1 tabPage2 等 一种无需代码即可实现的懒惰方法 选择选项卡控件 Go to properties use F4 to do
  • 编辑和重播 XHR chrome/firefox 等?

    我一直在寻找一种方法来改变XHR request在我的浏览器中制作 然后再次重播 说我有完整的POST请求在我的浏览器中完成 我唯一想要更改的是一个小值 然后再次播放 直接在浏览器中执行此操作会更容易 更快捷 我用谷歌搜索了一下 但没有找到
  • 嵌入清单文件以要求具有 mingw32 的管理员执行级别

    我正在 ubuntu 下使用 i586 mingw32msvc 交叉编译应用程序 我很难理解如何嵌入清单文件以要求 mingw32 具有管理员执行级别 对于我的例子 我使用了这个hello c int main return 0 这个资源文
  • python+win32:检测窗口拖动

    有没有办法检测何时使用 python pywin32 在窗口中拖动不属于我的应用程序的窗口 我想对其进行设置 以便当我拖动标题与桌面边缘附近的图案匹配的窗口时 当松开鼠标时它会捕捉到边缘 我可以编写代码 以便在释放鼠标时将所有具有该标题的窗
  • 更改 mingw' 启动目录或创建 mingw 符号链接

    设置 mingw 控制台启动目录的最简单方法是什么 我只使用 mingw 进行编译 但由于缺乏编辑器甚至符号链接 我很困惑如何告诉 mingw 控制台出现在不同的目录而不是常规的主目录中 如果有人知道如何像 cygwin 那样将 真正的 符
  • 我可以使用 Selenium Webdriver 测试元素的顺序吗?

    有一个表单 其中有 3 个字段 具有 3 个不同的 ID fieldset div div fieldset
  • 如何解决内存碎片

    我们偶尔会遇到这样的问题 长时间运行的服务器进程 在 Windows Server 2003 上运行 由于内存分配失败而引发异常 我们怀疑这些分配由于内存碎片而失败 因此 我们一直在寻找一些可能对我们有帮助的替代内存分配机制 我希望有人能告

随机推荐

  • 是否有用于 Java 或 PHP 的 OData 服务器库来公开 OData?

    我想知道是否有或为什么没有适用于 Java 的 ADO NET 数据服务服务器库 我需要从 Java 服务器公开数据库 但我只看到 Microsoft 为 java 提供客户端 而不是服务器部分 当您需要 NET Windows 来公开它时
  • CSS :before 和 :first-child 组合

    我使用以下代码在菜单项之间添加分隔符 navigation center li before content color fff 现在我希望第一个项目前面没有分隔符 所以我想出了以下代码 navigation center li befor
  • 在 Python 中递归地重新加载包(及其子模块)

    在 Python 中 您可以按如下方式重新加载模块 import foobar import importlib importlib reload foobar 这适用于 py文件 但对于 Python 包 它只会重新加载包并not任何嵌套
  • Angular HttpClient:“Blob”类型上不存在属性“headers”[重复]

    这个问题在这里已经有答案了 我正在使用 Angular 5 这是我从服务器下载文件的代码 1 服务 export url return this http get url responseType blob 2 组件代码 public do
  • ios6如何播放视频

    我很困惑 MPMoviePlayerViewController 和 MPMoviePlayerController 在 ios6 中本地播放视频的最佳方式是什么 这是我的代码 NSURL url NSURL fileURLWithPath
  • 导航回屏幕时不会调用 useEffect - React Navigation

    我有一个屏幕 可以调用 api 来获取一些数据 然后显示 我看到的一个问题是 当我离开屏幕 我使用的是 React navigation 6 x 然后返回到屏幕时useEffect 没有被调用 从我到目前为止读到的内容来看 这取决于user
  • 如何从进程名获取进程id?

    我正在尝试创建一个 shell 脚本来获取进程号我的 Mac 上的 Skype 应用程序 ps clx grep Skype grep Skype awk print 2 头 1 上面的方法工作正常 但是有两个问题 1 The grep如果
  • 如何获取其他应用的日志?

    我想从其他应用程序读取日志并过滤它们 以便当记录某个关键字时 我的应用程序将执行特定任务 我找到了几种读取日志的方法 但从我的测试来看 我只能获取我的应用程序日志 这是我最初尝试使用的方法 try Process process Runti
  • 如何知道 postNotificationName:object:userInfo 崩溃的位置

    有什么方法可以知道 Xcode 4 6 中的崩溃原因吗 The crash stack is Exception Type SIGSEGV Exception Codes SEGV ACCERR at 0xd9f2c061 Crashed
  • 使用 WebSockets...高效吗?

    我几乎阅读了所有关于 WebSockets 的指南和教程 但没有一个涵盖如何有效地使用它们 有人有关于如何执行此操作的任何指南吗 我担心单个连接可以占用的带宽量 特别是当应用程序打开数百个连接时 WebSocket 的效率取决于处理它们的
  • 使用 BookSleeve 的 ConnectionUtils.Connect() 将 SignalR 与 Redis 消息总线故障转移结合使用

    我正在尝试使用 SignalR 应用程序创建 Redis 消息总线故障转移场景 首先 我们尝试了一个简单的硬件负载平衡器故障转移 它只是监控两个 Redis 服务器 SignalR 应用程序指向单个 HLB 端点 然后 我使一台服务器出现故
  • 为什么选择排序不贪心

    我发现选择排序使用暴力策略 不过 我认为它使用了贪婪策略 为什么我认为它使用贪婪 它在外循环中从 0 到 n 1 从 i 1 到 n 1 这实在是太天真了 它在每次迭代中选择最小元素 它选择本地最好的元素 一切都像 贪婪 中的那样 但事实并
  • Python-将字符串中的单词与字符串列表进行匹配

    我是 python 新手 我想知道字符串比较是如何完成的 假设我有一个包含州名称的字符串列表 例如 states New York California Nebraska Idaho 我还有另一个包含地址的字符串 例如 postal add
  • 从 Django 模型获取数据并使用 AJAX 在 html 表中显示

    我已经搜索并实现了很多不同的方法来显示 html 表 使用 AJAX 从 JsonResponse Django 但无济于事 目前 我得到的最远的是对网络控制台的响应 products model products product pk 2
  • 多列上的 SELECT COUNT(DISTINCT...) 错误?

    我有一个表 VehicleModelYear 其中包含列 id 年份 品牌和型号 以下两个查询按预期工作 SELECT DISTINCT make model FROM VehicleModelYear SELECT COUNT DISTI
  • JS Regex - 替换 Markdown 链接的内容

    我几乎已经解决了一个正则表达式问题 只是一件小事 我正在尝试得到这个 and so use chalk api red string options 进入这个 and so use chalk red string options 我有这个
  • matplotlib 图例中的两个相邻符号

    我想在图例中的同一行上识别两个不同的符号 具有不同的颜色 下面 我尝试使用代理艺术家执行此操作 但结果是它们在图例中彼此堆叠 我希望它们彼此相邻或一个在另一个之上 这样它们都是可见的 from pylab import import mat
  • C# - XML - 压缩

    我遇到过这样的情况 我正在生成要提交到 Web 服务的 XML 文件 有时由于数据量超过 30mb 或 50mb 我需要使用 c net Framework 4 0 来压缩文件 而不是使用拥有大部分数据的节点之一 我不知道我要怎么做 如果有
  • Tomcat HTTP Access 日志写入文件有延迟

    在 tomcat 中 http 访问日志 Valve 需要一些时间才能写入文件 请注意 我有 org apache catalina valves AccessLogValve 的默认配置 有什么办法可以改善延迟吗 造成这种延迟的主要原因是
  • 在 Windows 上通过 Jenkins 使用 chromedriver 和 chrome 捕获屏幕截图时,从渲染器接收消息超时:10.000

    操作系统 Windows 10 浏览器 Chrome 浏览器版本 版本73 0 3683 86 官方版本 32位 我正在运行 selenium cucumber BDD 项目 我正在验证一页的标题 我正在使用范围报告版本4 项目在本地运行成