Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
硒铬C#不';如果浏览器最小化,则无法工作_C#_Selenium_Selenium Webdriver - Fatal编程技术网

硒铬C#不';如果浏览器最小化,则无法工作

硒铬C#不';如果浏览器最小化,则无法工作,c#,selenium,selenium-webdriver,C#,Selenium,Selenium Webdriver,我将Selenium Chrome驱动程序与我的小.NET应用程序集成。我在谷歌网页上做自动化。只要浏览器可见或在背景下,一切正常。如果我最小化它会在做任何工作之前停止。我有很多代码,显示了很多测试: var collection = cdriver.FindElements(By.TagName(@"input"),10); //var collection = cdriver.FindElementsByClassName("gwt-TextBox");

我将Selenium Chrome驱动程序与我的小.NET应用程序集成。我在谷歌网页上做自动化。只要浏览器可见或在背景下,一切正常。如果我最小化它会在做任何工作之前停止。我有很多代码,显示了很多测试:

        var collection = cdriver.FindElements(By.TagName(@"input"),10);
        //var collection = cdriver.FindElementsByClassName("gwt-TextBox");
        bool found = false;
        IWebElement texter = null;
        do
        {
        foreach (IWebElement element in collection)
        {
            if(element.GetAttribute("class").ToString() == "gwt-TextBox" ) 
            {
                if(element.Displayed==true) { found = true; texter = element; }
            }   
        }
        } while(!found);
        texter.SendKeys(readerCSV.apkTitle);
我有没有办法最小化chrome窗口,这样当窗口最大化或可见时,所有正常工作的代码也可以正常工作已启用测试无法按预期工作

另一个例子:

    var btnUpload = cdriver.FindElement(By.Id("gwt-uid-170"),10);
    btnUpload.Click();      

上面的btnUpload.click()代码为我提供了QpenQA.Selenium.ElementNotVisibleException


chrome驱动程序是否有启动选项,这样我就可以在不使用最小化按钮的情况下启动窗口?

chrome必须被拉上,因为驱动程序正在检查以确保元素对用户可见/启用/etc。只要停止最小化它,让它在后台运行,它就会工作。

那么你会遇到什么错误?QpenQA.Selenium.element不可见例外不要点击它!把这个作为答案贴出来,我会接受的!这里有什么问题?