小编Mos*_*hta的帖子

使用Google协议生成C#文件失败

我正在开发一个使用Java,C#和C++应用程序的项目.为了在他们之间进行通信,我正在尝试使用Google协议缓冲区.我正在使用以下.proto文件,它取自示例:

package tutorial;

message Person {
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;

  enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
  }

  message PhoneNumber {
    required string number = 1;
    optional PhoneType type = 2 [default = HOME];
  }

  repeated PhoneNumber phone = 4;
}

message AddressBook {
  repeated Person person = 1;
}
Run Code Online (Sandbox Code Playgroud)

我指的是以下教程:https: //developers.google.com/protocol-buffers/docs/csharptutorial

其他语言的教程也在那里.

我尝试了每种语言的命令行参数:

Java:

C:\ ProtoBuf\protoc -I = C:\ trash …

c# c++ java protocol-buffers

6
推荐指数
2
解决办法
4066
查看次数

使用selenium点击swf

我正在尝试使用Selenium IDE来点击html页面中的swf.DIV id和Embed id的变化取决于时间戳,例如id="FLASH_0_23458974594",我尝试过使用id=/^FLASH_([0-9]+_)[0-9]([0-9]+)/或者id="FLASH_glob:*"IDE没有接收到swf.我在这里做错了吗?

谢谢.

flash selenium

5
推荐指数
1
解决办法
6945
查看次数

Selenium 处理对象标签内的 html 元素

我正在努力验证 html 对象标记内的 html 元素。

以下是我的测试 html ( test1.html)。

<html>
<body>
    <h1>this is test 1</h1>
    <object id='obj1' width="100%" height="200px" data="http://www.w3schools.com/"></object>
    <br>    <br>    <br>    <br>
    <iframe id='ifr1' width="100%" height="200px" src="http://www.w3schools.com/"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

对于 的情况iframe,使用 webdriver switchtoframe 方法很容易处理,如下例所示。

@Test
public void testIframe() {
    try {
        FirefoxDriver driver = new FirefoxDriver();
        driver.get("http://localhost/test1.html");

        driver.switchTo().frame(0);
        Assert.assertTrue(driver.findElement(By.xpath("/html/body/div[1]/div")).getText().equals("THE WORLD'S LARGEST WEB DEVELOPER SITE"));

        driver.quit();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

但对于对象标签,switchTo方法不能以相同的方式应用。我很好奇 Selenium 提供了这种处理方式。

有人有解决这个问题的想法,或者有什么建议吗?

java selenium

5
推荐指数
1
解决办法
3842
查看次数

通过命令行运行Teamcity构建

我想通过命令行运行在Teamcity中创建的构建作业.是否可以通过命令行运行teamcity构建?如果是,那么命令是什么?

teamcity command-line

5
推荐指数
1
解决办法
3332
查看次数

无法使用ChromeDriver下载文件

我将chromedriver与硒结合使用,以从应用程序下载文件。但是在应用程序中单击下载按钮时,显示为“ Failed-Download error.” 错误

Chromedriver版本:2.21 Selenium版本:2.53.0

用于初始化chrome驱动程序和更改下载位置的代码:

            String newPath = "D:\\Backup" + File.separator + "Database ";
            new File(newPath).mkdir();
            HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
            chromePrefs.put("profile.default_content_settings.popups", 0);
            chromePrefs.put("download.default_directory", newPath);
            chromePrefs.put("safebrowsing.enabled", "true");
            ChromeOptions options = new ChromeOptions();
            options.setExperimentalOption("prefs", chromePrefs);
            options.addArguments("--test-type");
            DesiredCapabilities cap = DesiredCapabilities.chrome();
            cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
            cap.setCapability("disable-popup-blocking", true);
            cap.setCapability(ChromeOptions.CAPABILITY, options);
            System.setProperty("webdriver.chrome.driver", CHROME_DRIVER_PATH);
            driver = new ChromeDriver(cap);
            // Maximize the driver window
            driver.manage().window().maximize();
Run Code Online (Sandbox Code Playgroud)

错误是

在此处输入图片说明

有人可以帮我弄这个吗?我可以从Chrome手动下载文件。

java selenium selenium-chromedriver

5
推荐指数
2
解决办法
2691
查看次数

Selenium v​​s XmlUnit + HttpClient用于Web REST API测试

我需要以REST格式测试Web API函数.目前使用Selenium RC对网站进行功能测试.并使用XmlUnitHttpClient功能测试我们的REST API.但是,如果我们能够真正将功能测试代码分离到所有的硒中,那么生活似乎会更容易.特别是使用Selenium 2.0的WebDriver,使用它来测试XML响应比以往任何时候都容易XPath.

我在Pro XmlUnit+HttpClient营地的想法:

  • 允许使用直接数据库调用或Spring bean轻松进行测试
  • 更容易允许在/我们将来支持时测试JSON响应
  • selenium用于Web UI,而不是REST API测试

我在Pro Selenium WebDriver营地的想法:

  • 将功能测试全部分解为标准的硒测试
  • 通过使用我们的其他selenium UI测试轻松测试结果,进一步测试UI
  • 允许其他人而不是核心开发人员审查功能API测试
  • 也许更容易使用像BrowserMob这样使用selenium测试的服务来加载测试API?
  • 希望用selenium框架更快地进行功能测试

我们正在使用Spring 3和hibernate.什么是最好的功能测试我们的API?

testing selenium functional-testing selenium-rc web-api-testing

4
推荐指数
1
解决办法
6396
查看次数

使用selenium进行爬网:如何在java中关闭驱动程序后保持登录状态

无论如何,那司机能记住logged in session,所以它不会带我回到Login页面(例如喜欢google-chrome)吗?

这就是我现在正在做的事情

public static void main(String[] args) throws Exception {

    driver = new ChromeDriver();
    driver.get("http://localhost/interestingStuff);  //I get redirected to login page 

    login(); //logins in to the page and submits(note I try to omit this part if possible).
    doStuff();

    driver.close(); //I want to be able to keep session next time I start this program.


}
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-webdriver

4
推荐指数
1
解决办法
4900
查看次数

在eclipse中有一个生成资源的快捷方式(构造函数,获取/设置.....)

目前在eclipse中,如果我想生成一个构造函数或getter/setter我去类名右键单击 - > source->访问正确的Generation选项

日食

虽然在Android工作室我们有一个方便快捷的快捷方式,我只需要按下CMD+N页面中的任何地方打开生成对话框

安卓工作室

是否有可用的日食快捷方式?

java eclipse android android-studio

4
推荐指数
1
解决办法
1325
查看次数

Java显示当前年份不正确

我已经编写了打印当前日期的代码.

Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("ddMMYYYY");
String newdate = dateFormat.format(date);
Run Code Online (Sandbox Code Playgroud)

但它输出为:29122016
实际输出应为:29122015
系统日期也正确.

代码有什么问题?

java datetime

4
推荐指数
1
解决办法
99
查看次数

Firefox Webdriver 非常慢

我们使用 selenium webdriver dll 设置来运行我的自动化套件。我只在 Firefox 中运行测试时遇到这个问题。Firefox 中的测试运行非常缓慢,加载页面需要 3-4 分钟,但是,当我手动使用 Firefox 浏览器在同一台机器上运行相同的测试时,我没有遇到这种缓慢的情况。有时在 Firefox 上运行自动化时,我们也会看到“连接已重置”页面。此外,相同的测试在 Chrome 和 IE 中运行良好。

我们使用以下环境:

Firefox 版本 28、37(代理设置为使用系统设置)

Webdriver (dll) 版本 2.45

Windows 7的

之前我们使用 Firefox 版本 14,16 和 Webdriver 版本 2.37 在 Windows XP 中运行相同的设置,我们没有遇到这个问题。

我们使用以下代码调用 Firefox:

Proxy proxy = new Proxy();
proxy.Kind = ProxyKind.System;
FirefoxProfile profile = new FirefoxProfile(); 
profile.SetProxyPreferences(proxy);

RemoteWebDriver dr = new FirefoxDriver(new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"), profile, TimeSpan.FromSeconds(120));

dr.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));

dr.Manage().Window.Maximize();

dr.Manage().Cookies.DeleteAllCookies();

dr.Navigate().GoToUrl(WebSiteUrl);
Run Code Online (Sandbox Code Playgroud)

剩余测试步骤......

请有人帮我解决这个问题。

提前致谢。

selenium windows-7 selenium-firefoxdriver

3
推荐指数
1
解决办法
4948
查看次数