テスト用にSeleniumを設定しようとしていますが、私のwebdriversは動作しません。私は、プロジェクトフォルダ内の周りにそれらを移動しようとしていると私はビジュアル・スタジオがそれらを見つけるために得ることができる唯一の方法は、@「パス」文です。Selenium - Visual Studios- C# - すべてのドライバ(chrome、firefox、およびInternet Explorer)webdriversがドライバサービスを開始できません
Visual Studioはwebdriverをを見つけたら、本当の問題は、...操作がタイムアウトであると、私は次の例外を取得します:型「OpenQA.Selenium.WebDriverException」の
未処理の例外は、webdriverを中に発生しました。 DLL 追加情報:毎回変わるhttp://localhost:(randomポート番号のドライバーサービスを開始することはできません)
は、私は(自分のコンピュータを再起動し、システム管理者は、ファイアウォールやマルウェアブロッカーログをチェックしたしようとしたが、どちらも役立っているようだありませんでしたまたは彼らは探して正しいことを知らない)。
私はこれは非常に単純なものだと私はちょうどそれを逃している... ...任意の助けをいただければ幸いです。ここで
は、私のコードのコピーである:ここで
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
namespace SeleniumWork
{
class Program
{
static void Main(string[] args)
{
IWebDriver driver = new InternetExplorerDriver(@"C:\blahblahpathstring");
driver.Navigate().GoToUrl("http://www.google.com/");
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("Cheese");
query.Submit();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(d => d.Title.StartsWith("cheese", StringComparison.OrdinalIgnoreCase));
Console.WriteLine("Page title is: " + driver.Title);
}
}
}
は私が受け取るデバッグ出力のコピーです:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll
あなたのwebdriversを見つけることができないため、問題があると思います。あなたはそれらを右クリックし、 "Copy Always = TRUE"と設定しましたか?これで、あなたのドライバーは他のアッセンブリーと同じレベルになります。 –
Copy to Output Directoryプロパティを参照していますか?私はそれを「常にコピー」にマークし、ドライバサービスのエラーを開始できません。 WebDriversのプロパティは次のとおりです。ビルドアクション:コンテンツ、出力ディレクトリにコピー:常にコピー、カスタムツール:(空白)、カスタムツール名前空間:(空白)、ファイル名:IEDriverServer.exe/GeckoDriver.exe/ChromeDriver。 exe – tinneko
出力ディレクトリにコピーします。申し訳ありませんが、私の悪い... –