Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.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# IE10和IE11中的ElementNotVisibleException_C#_Selenium Webdriver_Internet Explorer 10_Internet Explorer 11 - Fatal编程技术网

C# IE10和IE11中的ElementNotVisibleException

C# IE10和IE11中的ElementNotVisibleException,c#,selenium-webdriver,internet-explorer-10,internet-explorer-11,C#,Selenium Webdriver,Internet Explorer 10,Internet Explorer 11,我有一个chrome驱动程序的测试用例 然后我为ie10和ie-11驱动程序执行它(使用BrowserStack),它抛出一个execption(见下文),基本上我使用 IWebElement myElement=\u driver.FindElement(By.XPath(“/*/input[@type='file']) 方法。当我跑的时候 myElement.SendKeys(@"C:\Users\hello\Documents\images\wallpaper1.jpg"); 它抛出下面

我有一个chrome驱动程序的测试用例

然后我为ie10和ie-11驱动程序执行它(使用BrowserStack),它抛出一个execption(见下文),基本上我使用

IWebElement myElement=\u driver.FindElement(By.XPath(“/*/input[@type='file'])

方法。当我跑的时候

myElement.SendKeys(@"C:\Users\hello\Documents\images\wallpaper1.jpg");
它抛出下面的异常

    OpenQA.Selenium.ElementNotVisibleException : Element is not displayed
 (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 61 milliseconds
    Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
    System info: host: '5-255-92-204', ip: '5.255.92.204', os.name: 'windows', os.arch: 'x86', os.version: '6.2', java.version: '1.8.0_40'
    Driver info: org.openqa.selenium.ie.InternetExplorerDriver
    Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=10, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=true, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:31891/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
    Session ID: 3380bb44-31a8-45a6-90c1-84447a153e7a

但是元素在页面内。

您无法与禁用或不可见的元素交互。您是否尝试过线程。睡眠以等待页面加载?你需要为人们提供你的页面源代码来诊断你的问题。首先,这个问题与
By.XPath
无关。发现的元素很好。其次,我强烈怀疑你的网站的开发者认为
元素很难看,并试图提供一个“更漂亮”的替代方案。如果您的开发人员(或JavaScript小部件工具包的开发人员)已经以最常见的方式完成了这项工作,那么您将对IE驱动程序代码库感兴趣。