0

私はc#.NET4.0でセレンを使用してFirefoxのプロセスを自動化しています:

    static void Main(string[] args)
    {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://www.microsoft.com/");

        selenium.Start();
        selenium.SetSpeed("900");

        selenium.WindowMaximize();
        selenium.WindowFocus();

        Login();
     }

public static void LogIn()
        {
            verificationErrors = new StringBuilder();

        selenium.SetSpeed("900");
        selenium.Open("/Login.aspx");

        selenium.Type("id=ctl00_cphBody_objLogin_UserName", "user");

        selenium.Type("id=ctl00_cphBody_objLogin_Password", "P@assword");

        selenium.Click("id=ctl00_cphBody_objLogin_LoginImageButton");

        selenium.WaitForPageToLoad("30000");    

            try
            {
                selenium.IsTextPresent("Orders - Drug Testing");

            }
            catch (Exception)
            {
                Console.WriteLine("Could't find text: Orders - Drug Testing.");

            }


    }

Firefoxが開き、その後は何も起こりません。要求されたページには移動しません。

これがその様子です。私は何が間違っているのですか?すべてが正常に動作しますIE

ここに画像の説明を入力してください

4

1 に答える 1

2

要求されたページに移動するには、次のコードを使用する必要があります。

Selenium は、 & を呼び出さない限り、ページまたはベース URL に自動的に移動しません。

selenium.open(" < your url goes here > ");

元 :selenium.open("https://mail.google.com");

于 2012-07-27T05:01:52.910 に答える