26

में सी # के साथ सेलेनियम परीक्षण चलाने के दौरान त्रुटि मैं सी # के साथ वेबड्राइवर का उपयोग कर ऑटोमेशन फ्रेमवर्क पर काम कर रहा हूं। यह फ़ायरफ़ॉक्स के साथ ठीक काम कर रहा है लेकिन आईई के साथ नहीं।"IEDriverServer मौजूद नहीं है" विंडोज 7

IEDriverServer.exe does not exist-The file c:\users\administrator\documents\visual studio 2010\projects\TestProject1\TestProject1\bin\Debug\IEDriverServer.exe does not exist. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list

मैं IE 9 और Windows 7.

IWebDriver driver = new InternetExplorerDriver(); 
driver.Navigate().GoToUrl("http://www.google.co.uk"); 
IWebElement queryBox = driver.FindElement(By.Name("q")); 
queryBox.SendKeys("The Automated Tester"); 
queryBox.SendKeys(Keys.ArrowDown); 
queryBox.Submit(); 

भी this screenshot देखें उपयोग कर रहा हूँ:

मैं निम्न त्रुटि हो रही है।

+0

बस इसे आउटपुट निर्देशिका Bin \ Debug पर कॉपी करें यदि यह पहले से मौजूद नहीं है। –

उत्तर

11

प्रति जिम इवांस (जो IEDriverServer पर काम करता है)

The .NET bindings don't scan the %PATH% environment variable for the executable. That means for the .NET bindings only, the IEDriverServer.exe is expected to either be found in the same directory as the .NET bindings assembly, or you must specify the directory where it can be found in the constructor to the InternetExplorerDriver class.

Failure to do one of these things (or to set the UseInternalServer property in the InternetExplorerOptions class) will cause the .NET IE driver implementation to throw an exception. This is strictly by design, as we want people to begin using the standalone IEDriverServer.exe, and the ability to use an "internal" or "legacy" version of the server will be removed in a future release.

https://groups.google.com/forum/?fromgroups#!topic/webdriver/EvTyEPYchxE

+0

क्या आप कोड नमूना के साथ मेरी मदद कर सकते हैं IEDriverServer.exe को सी # का उपयोग करके कैसे बांधें। क्या यह इस तरह से सिस्टम है। पर्यावरण .etEnvironmentVariable ("webdriver.ie.driver", "डी: //Software//IEDriverServer.exe") ; IWebDriver ड्राइवर = नया InternetExplorerDriver(); – Pat

+0

मैंने सी # बाइंडिंग में काम नहीं किया है। हालांकि, इस बाहरी कोड को हल करने का एक तरीका है, सेलेनियम जार शुरू करते समय इस चर को पारित करना। जावा-सेलेनियम-सर्वर की तरह .jar-Dwebdriver.ie.driver = "डी: //Software//IEDriverServer.exe" –

+0

अब [क्रोम] के लिए अनौपचारिक NuGet पैकेज हैं (https://www.nuget.org/ पैकेज/सेलेनियम.WebDriver.ChromeDriver /) और [आईई] (https://www.nuget.org/packages/Selenium.WebDriver.IEDriver/); ये आपके पैकेज निर्देशिका में ड्राइवर जोड़ते हैं, उन्हें अपने परीक्षण प्रोजेक्ट में लिंक जोड़ते हैं, और "अगर नई हो तो कॉपी करें" पर सेट करें। फिर बस "।" गुजरने वाले कन्स्ट्रक्टर ओवरलोड को कॉल करें। वर्तमान निर्देशिका के लिए * (उपरोक्त% PATH% समस्या के कारण) *; उदा: 'ScenarioContext.Current ["ब्राउज़र"] = नया क्रोमड्राइवर ("।");' [एनसीआरंच] के साथ (http://www.ncrunch.net/) मुझे फ़ाइलों को कॉपी करने के लिए इसे कॉन्फ़िगर करने की आवश्यकता नहीं थी । – Damon

1

आप दृश्य स्टूडियो और सी # मैं अपने NareshScaler nuget पैकेज को नवीनीकृत किया है स्वचालित रूप से IEDriverServer, ChromeDriver आदि स्थापित करने के लिए साथ काम कर रहे हैं , जिसका अर्थ है कि आप उठ सकते हैं और तेजी से चल सकते हैं।

http://nuget.org/packages/NareshScaler

+0

क्या आप सी # कोड – Pat

16

यहाँ कैसे InternetExplorerDriver कॉल करने के लिए IEDriverServer.exe का उपयोग करने का एक सरल सी # उदाहरण है।

आपकी आवश्यकताओं के अनुसार रिएक्टर।

नोट:driver.Quit() का उपयोग जो सुनिश्चित करता है कि परीक्षण समाप्त होने के बाद IEDriverServer.exe प्रक्रिया बंद है।

http://selenium-release.storage.googleapis.com/index.html:

using Microsoft.VisualStudio.TestTools.UnitTesting; 
using OpenQA.Selenium.IE; 

namespace SeleniumTest 
{ 
    [TestClass] 
    public class IEDriverTest 
    { 
     private const string URL = "http://url"; 
     private const string IE_DRIVER_PATH = @"C:\PathTo\IEDriverServer.exe"; 

     [TestMethod] 
     public void Test() 
     { 
      var options = new InternetExplorerOptions() 
      { 
       InitialBrowserUrl = URL, 
       IntroduceInstabilityByIgnoringProtectedModeSettings = true 
      }; 
      var driver = new InternetExplorerDriver(IE_DRIVER_PATH, options); 
      driver.Navigate(); 
      driver.Close(); // closes browser 
      driver.Quit(); // closes IEDriverServer process 
     } 
    } 
} 
+1

धन्यवाद राल्प का उपयोग कर NareshScaler पैकेज का उपयोग किये बिना इसे करने में मेरी सहायता कर सकते हैं .. यह अभी ठीक काम करता है। – Pat

20

IEDriverServer.exe (और साथ ही ChromeDriver.exe) से डाउनलोड किया जा सकता है।

अपने सेलेनियम परीक्षणों के साथ काम करने के लिए, अपने परीक्षण प्रोजेक्ट में .exe शामिल करें, और इसकी गुणों को 'हमेशा कॉपी करें' पर सेट करें।

नोट: आपको .exe फ़ाइलों को प्रदर्शित करने के लिए फ़ाइल जोड़ें संवाद को समायोजित करना होगा।

ऐसा करने से त्रुटि हल हो जाएगी।

0
 public IWebDriver IEWebDriver() 
    { 
     var options = new InternetExplorerOptions(); 
     options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; 
     webDriver = new InternetExplorerDriver(ConfigurationSettings.AppSettings["IDEServerPath"].ToString(), options);//Path of ur IE WebDriver,Here I stored it in a AppConfig File 
     return webDriver; 
    } 
1

जावा के साथ जावा का उपयोग करने के लिए वेब का उपयोग करने के लिए कोड। मेरा मानना ​​है कि इस अवधारणा को आप सी # प्रयोग करने के लिए उपयोगी हो सकता है: "फाइल फ़ाइल = नई फ़ाइल (" सी के बजाय निम्नलिखित ऊपर कोड का उपयोग काम नहीं करता है

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); 
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);  
File file = new File("C:\\Program Files\\Internet Explorer\\iexplore.exe"); 
System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); 
driver = new InternetExplorerDriver(capabilities); 

हैं: \ Program Files \ इंटरनेट एक्सप्लोरर \ iexplore। exe "),":

File file = new File("F:\\Ripon\\IEDriverServer_Win32_2.25.2\\IEDriverServer.exe"); 

[नोट: IEDriverServer और Windows (32 या 64 बिट के संस्करण) व्यक्ति के लिए अलग-अलग भिन्न हो सकते हैं]

+0

मैंने "IEDriverServer_Win32_2.31.0.zip" डाउनलोड किया। आपकी मार्गदर्शिका के अनुसार यह अच्छी तरह से काम कर रहा है। धन्यवाद रिपोन –

+0

@ user2027659: यह मेरी खुशी है –

1

केवल जहां Internetexplorer.exe स्थित है फ़ोल्डर तक मार्ग दे।

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using OpenQA.Selenium; 
using OpenQA.Selenium.Firefox; 
using OpenQA.Selenium.IE; 
using System.IO; 

namespace Automation 
    { 
    class To_Run_IE 
    { 
     static void Main(string[] args) 
     { 
     //Keep Internetexplorer.exe in "D:\Automation\32\Internetexplorer.exe" 
      IWebDriver driver = new InternetExplorerDriver(@"D:\Automation\32\"); \\Give path till the exe folder 
     //IWebDriver driver = new Firefoxdriver() 
     driver.Navigate().GoToUrl("http://www.google.com/"); 
     driver.Manage().Window.Maximize();   
     IWebElement query = driver.FindElement(By.Name("q")); 
     query.SendKeys("Cheese");   
     query.Submit();   
     System.Console.WriteLine("Page title is: " + driver.Title); 
     driver.Quit(); 
    } 
} } 
+0

हाय निथिन और साइट पर आपका स्वागत है। क्या आप इसे अपने उत्तर पर विस्तार करने पर विचार कर सकते हैं ताकि इसे और अधिक पूरा किया जा सके? अच्छे उत्तरों के लिए एक गाइड है [यहां] (http://stackoverflow.com/help/how-to-answer) - आम तौर पर हम एक-पंक्ति उत्तर से थोड़ा अधिक स्पष्टीकरण पसंद करते हैं। – starsplusplus