【问题标题】:Launching firefox....(selenium)启动火狐....(硒)
【发布时间】:2012-04-12 17:40:25
【问题描述】:

我在 Visual Studio 2008 上运行 selenium 代码。代码是这样的..

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;

namespace SeleniumTests
{
[TestFixture]
public class MyFirstVCTest
{
    private ISelenium selenium;
    private StringBuilder verificationErrors;

    [SetUp]
    public void SetupTest()
    {
        selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://demo.volunteercampaigns.com/");
        selenium.Start();
        verificationErrors = new StringBuilder();
    }

    [TearDown]
    public void TeardownTest()
    {
        try
        {
            selenium.Stop();
        }
        catch (Exception)
        {
            // Ignore errors if unable to close the browser
        }
        Assert.AreEqual("", verificationErrors.ToString());
    }

    [Test]
    public void TheMyFirstVCTest()
    {

        selenium.Open("/?AspxAutoDetectCookieSupport=1");
        selenium.Click("link=Login");
        selenium.WaitForPageToLoad("30000");
        selenium.Type("id=ctl00_ContentPlaceHolder1_txtEmailAddress", "elonadn@ebees.com");
        selenium.Type("id=ctl00_ContentPlaceHolder1_txtPassword", "bees123");
        selenium.Click("id=ctl00_ContentPlaceHolder1_btnlogin");
        selenium.WaitForPageToLoad("30000");
        selenium.Click("id=ctl00_lblUserName");
        selenium.Click("id=ctl00_lnkSignOut");
        selenium.WaitForPageToLoad("30000");
    }
}
}

我使用以下命令(在命令提示符中)启动了 selenium 服务器服务器

java -jar selenium-server.jar

我得到了以下屏幕

然后我开始运行我的程序。但我有一个空的 Firefox 窗口。现在命令提示符更改为

为什么它在启动 Firefox 时停止?请帮忙..

我的firefox版本是11.0,selenium版本是2.20.0

提前谢谢..

【问题讨论】:

    标签: selenium


    【解决方案1】:

    我认为错误在于您的配置中列出了 chrome。不应该是*firefox吗?

    【讨论】:

    • 嗯。我唯一的另一个猜测是 Selnium 2 不支持 Firefox 11。我对旧版本的 Selenium 有限制,它不支持最新版本。我会尝试其他版本..即使是 IE 或 Chrome,因为它支持几乎所有的浏览器(但并不总是最新版本)
    • 是的,看起来其他人在 Selenium 2 中遇到了 Firefox 11 的问题 groups.google.com/group/selenium-users/browse_thread/thread/… 我会尝试降级到 Firefox 10
    • 是的。你是对的。我刚刚安装了 ff4 并且工作正常。非常感谢你.. :)
    • "chrome" 在 Selenium RC 中表示 Firefox。这是一种长期使用,早在谷歌决定将他们的浏览器称为“Chrome”之前,它就被 Mozilla 基金会推广了。 Selenium RC 使用“googlechrome”来指代 Chrome。
    • 我将其标记为答案,因为我通过 TGH 的评论找到了解决方案。谢谢 TGH。
    猜你喜欢
    • 1970-01-01
    • 2023-03-13
    • 2017-03-03
    • 2012-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-15
    相关资源
    最近更新 更多