小编Paw*_*ski的帖子

ChromeWebDriver - 未知错误:Chrome无法启动:崩溃

我正在尝试使用ChromeWebDriver在Chrome上测试我的应用程序,但每次尝试时都会出现以下异常:

   org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.46 seconds
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'PADAMSKI-W', ip: '10.10.8.60', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_37'
Driver info: pl.axit.test.selenium.env.KoralinaChromeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:181)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at …
Run Code Online (Sandbox Code Playgroud)

selenium google-chrome chrome-web-driver

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

为什么Java StringReader会抛出IOException?

今天我正在使用Java类StringReader,我发现它在read方法上抛出IOException非常烦人.我知道它扩展了Reader类在哪个方法read抛出IOException,但我认为StringReader不需要它.此类不使用任何可能导致错误的外部资源.

短暂调查后,我发现,StringReader#read抛出IOException如果字符串,这个类读取为空,但事实上这是不可能发生的,因为如果我们将试图传递null StringReader构造器,它抛出NPE.

您如何看待它,总是抛出与超类相同的异常是一种好习惯吗?


编辑:如U Mad Reader所述,是一个不是接口的类.

java api stringreader

7
推荐指数
2
解决办法
1757
查看次数

使用lodash列出所有可能的路径

我想列出导致叶子的所有物体路径

例:

var obj = {
 a:"1",
 b:{
  foo:"2",
  bar:3
 },
 c:[0,1]
}
Run Code Online (Sandbox Code Playgroud)

结果:

"a","b.foo","b.bar", "c[0]","c[1]"
Run Code Online (Sandbox Code Playgroud)

我想找到简单易读的解决方案,最好使用lodash.

javascript lodash

7
推荐指数
2
解决办法
3192
查看次数

为什么CSS绝对不能用于静态父级?

W3Schools

元素与position: absolute相对于最近定位的祖先定位.其中 定位元素是其位置,除了静态的东西.

我的问题是为什么static要排除元素?我知道我可以设置position: relative;left:0px;top:0px;right:0px;bottom:0px哪个与position:staticIMO 相同,但它看起来像是一种解决方法.

html css

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

Quartz JobDataMap 不适用于非原始类型

Quartz JobDataMap有以下问题。我希望当使用简单的 Quartz Job并将非原始对象(例如StringBuilder 的实例)传递JobDateMap 时,应该始终使用我放置的不同对象副本调用方法execute(从我的工作)。不幸的是,我总是得到我放入JobDateMap的对象实例(就像它是一个 StatefulJob)。

在下面的示例中,我希望在每次调用中都得到一个 '*',而每次我都会再得到一个 '*'。

public class MyJob implements Job {

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

        SchedulerFactory schedFact = new StdSchedulerFactory();
        Scheduler sched = schedFact.getScheduler();

        JobDetail jobDetail = new JobDetail("job", Scheduler.DEFAULT_GROUP, MyJob.class);
        jobDetail.getJobDataMap().put("param", new StringBuilder());

        Trigger trigger = TriggerUtils.makeImmediateTrigger("trigger", 10, 100);
        trigger.setGroup(Scheduler.DEFAULT_GROUP);

        sched.scheduleJob(jobDetail, trigger);
        sched.start();

        try {
            Thread.sleep(1000L);
        } catch (Exception e) {}

        sched.shutdown(true);

    }

    @Override
    public void execute(JobExecutionContext context) …
Run Code Online (Sandbox Code Playgroud)

java quartz-scheduler

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

即使Golang结构具有相同的功能,它也不会实现接口

我不知道编译错误的原因是什么.我将不胜感激任何帮助.

./router.go:190: cannot use listener (type webhooklistener.MyListener) as type webhook.Listener in field value:
    webhooklistener.MyListener does not implement webhook.Listener (missing webhook.handle method)
        have webhooklistener.handle()
        want webhook.handle()
Run Code Online (Sandbox Code Playgroud)

客户:

package webhook

type Listener interface {
    handle()
}

type Client struct {
    Listener Listener
}
Run Code Online (Sandbox Code Playgroud)

监听器:

package webhooklistener

type MyListener struct {
}

func (ll MyListener) handle() {

}
Run Code Online (Sandbox Code Playgroud)

路由器:

listener := webhooklistener.MyListener{}
client := webhook.Client{listener} // COMPILATION ERROR
Run Code Online (Sandbox Code Playgroud)

go

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

对每个更改的文件执行命令

我想对每个没有暂存更改的文件执行一些 shell 命令。

例如,如果git status显示

On branch xxxxxxx
Your branch is up-to-date with 'origin/xxxxxxxxx'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   client/.../reports.coffee
    modified:   client.../tools.coffee
Run Code Online (Sandbox Code Playgroud)

我想对文件reports.coffeetools.coffee.

我不想使用,find因为文件可以在不同的时间更改。我怎样才能做到这一点?

git bash

4
推荐指数
2
解决办法
1600
查看次数

为每条日志消息添加自定义值

假设我有一个带有端点的 REST API /user/{user_id}/foo。现在,当调用它时,我希望处理此请求的所有日志都包含有关{user_id}. {user_id}是否可以在不传递每个方法的情况下实现这一目标?

我使用 SLF4j 进行日志记录,我的应用程序基于 Spring Boot。

java slf4j spring-boot

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

无参数功能的标准接口

Java 6(或任何兼容库)标准接口是否存在无参数函数和泛型返回类型.

就像是:

interface Foo<T> {
      T call();
}
Run Code Online (Sandbox Code Playgroud)

java shared-libraries java-6

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

模拟对象不起作用

double checkAndReturnDoubleIfOk(String stringToCheck) {
        double price = 0;
        try {
            price = Double.valueOf(stringToCheck);
        } catch (NumberFormatException e) {
            System.err.println("Price is not a number");
            return -1;
        }
        String[] array = stringToCheck.split("\\.");
        if (array[1].length() < 3 & price > 0) {
            return price;
        } else {
            throw new WrongCostFormat();
        }

    }

@Test(expected = WrongCostFormat.class)
    public void shouldThrowNumberFormatException() {

        Product mock = mock(Product.class);
        double number = mock.checkAndReturnDoubleIfOk("1.234");     

    }
Run Code Online (Sandbox Code Playgroud)

我是JUnit和Mockito世界的新手,无法弄清楚,为什么测试失败了.有什么建议?我调试了测试文件,似乎数字是0.0而不是抛出异常...包异常;

public class WrongCostFormat extends RuntimeException {

    public WrongCostFormat() {
        super();
    }

    public WrongCostFormat(String s) …
Run Code Online (Sandbox Code Playgroud)

java junit mockito

2
推荐指数
1
解决办法
745
查看次数