小编Psl*_*Psl的帖子

如何使用Selenium单击href链接

我有一个HTML href链接

<a href="/docs/configuration">App Configuration</a>
Run Code Online (Sandbox Code Playgroud)

使用Selenium我需要点击链接.目前,我使用下面的代码 -

Driver.findElement(By.xpath("//a[text()='App Configuration']")).click(); 
Run Code Online (Sandbox Code Playgroud)

但它没有重定向到页面.我也试过下面的代码 -

 Driver.findElement(By.xpath(//a[@href ='/docs/configuration']")).click();
Run Code Online (Sandbox Code Playgroud)

但这是抛出异常 -

org.openqa.selenium.ElementNotVisibleException:元素当前不可见,因此可能无法与命令持续时间或超时交互:13毫秒

链接可见,页面已完全加载.我不知道我的代码有什么问题.

java selenium xpath

16
推荐指数
2
解决办法
14万
查看次数

使用javascript从datetime中提取时间

如何从日期时间格式中提取时间.

我的日期时间格式如下.

var datetime =2000-01-01 01:00:00 UTC;
Run Code Online (Sandbox Code Playgroud)

我只想要得到的时间01.0001

javascript

15
推荐指数
5
解决办法
6万
查看次数

div元素中带换行符的文本无效

我有一个div元素

<div id="testResult" style="padding-left: 120px;">
Run Code Online (Sandbox Code Playgroud)

我试图'\n'div元素内打印带有换行符的文本.

但在我的html页面显示文本忽略换行符.

 $("#testResult").html("Feature: Apply filter to image\n    As an user\n    I want to be able to apply a filter to my image\n    So I can make it look better and match my card's stile\n\n  @US2330 @done\n  Scenario Outline: Apply filter to a picture    # features/card_edit_filter.feature:33\n    Given I am on \"Filters Editor\" screen        # features/step_definitions/common_steps.rb:1\n    And I see my card with the original image    # features/step_definitions/card_filter_steps.rb:21\n    When I touch the …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

每5分钟安排一份工作

我使用以下job scheduler代码Today is recognized by Rebecca Black!-每天上午12点打印.

// executes every day at 12:AM
var rule = new schedule.RecurrenceRule();
rule.dayOfWeek = [0, new schedule.Range(1, 6)];
rule.hour = 15;
rule.minute = 14;
schedule.scheduleJob(rule, function() {
console.log(rule);
    console.log('Today is recognized by Rebecca Black!---------------------------');
});
Run Code Online (Sandbox Code Playgroud)

我如何打印每5分钟我使用以下方式,但它不工作...

var rule = new schedule.RecurrenceRule();

rule.minute = 5;
schedule.scheduleJob(rule, function() {
console.log(rule);
    console.log('Today is recognized by Rebecca Black!---------------------------');
});
Run Code Online (Sandbox Code Playgroud)

javascript node.js

14
推荐指数
2
解决办法
3万
查看次数

从字符串中删除"http://"和"https://"

是新的使用正则表达式我.怎么可以删除红宝石httpshttpwww从字符串

server= http://france24.miles.com
server= https://seloger.com
Run Code Online (Sandbox Code Playgroud)

从这些网站我想删除所有 http ,https and www

france24.miles.com
seloger.com
Run Code Online (Sandbox Code Playgroud)

我使用下面的代码,但它不是为了我

server = server.(/^https?\:\/\/(www.)?/,'')
Run Code Online (Sandbox Code Playgroud)

ruby regex

8
推荐指数
3
解决办法
4510
查看次数

java.lang.ClassCastException:java.util.HashMap $ EntrySet无法强制转换为java.util.Map $ Entry

我有这样的overrriden方法

@Override
public Build auth (Map.Entry<String, String> auth) {
            this.mAuth = auth;
            return this;
}
Run Code Online (Sandbox Code Playgroud)

这里我试图以下面的方式调用此方法

Map<String, String> authentication = new HashMap<String , String> ();        
         authentication.put("username" , "testname");
         authentication.put("password" , "testpassword");        

Map.Entry<String, String> authInfo =(Entry<String , String>) authentication.entrySet();

AuthMethod.auth(authInfo)
Run Code Online (Sandbox Code Playgroud)

虽然正在运行这个

java.lang.ClassCastException: java.util.HashMap$EntrySet cannot be cast to java.util.Map$Entry
Run Code Online (Sandbox Code Playgroud)

我怎样才能传递Map.Entry<String, String>给auth方法

java dictionary

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

使用角度js更改文本外观

我是角度js的新手使用这个ihave来执行以下操作我有一个文本名称bob.and一个像粗体和斜体的按钮,同时按下粗体按钮我想要加粗文本BOB和斜体,同时单击斜体按钮

这是代码

HTML

 <div ng-controller="MyCtrl">
      <input type="text" ng-model="rootFolders" ng-init="rootFolders='Bob'" >
          <button ng-click="chiliSpicy()">bold</button>
     <button ng-click="jalapenoSpicy()">italic</button>
    <br>{{rootFolders}}
    </div>
Run Code Online (Sandbox Code Playgroud)

  var app = angular.module('myApp',[]);

    function MyCtrl($scope) {   

    }
Run Code Online (Sandbox Code Playgroud)

jfiddle

javascript jquery angularjs

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

使用带有ruby的Amazon Simple Notification服务SNS

我需要从基于ruby的应用程序中使用Amazon Simple Notification Service,并且不知道从哪里开始.

你有什么建议从哪里开始?

ruby ruby-on-rails amazon-sns

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

连接超时.为什么?

运行此代码时出现异常.为什么?

线程"main"中的异常java.net.ConnectException:连接超时:connect

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

public class MainClass {

  public static void main(String[] args) throws Exception {
    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

    URL url = new URL("https://www.verisign.com/");
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));

    String line;
    while ((line = in.readLine()) != null) {
      System.out.println(line);
    }
    in.close();
  }
}
Run Code Online (Sandbox Code Playgroud)

例外:

Exception in thread "main" java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:525)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550)
    at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) …
Run Code Online (Sandbox Code Playgroud)

java

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

在node.js中生成子进程

node.js我试图产生一个子进程

我也必须(mode=All在执行exe文件时传递参数

我是按照以下方式做的.但是没有得到任何东西

`var exec = require('child_process').execFile;
var fun =function(){ 
   exec('Sample.exe mode=All', function(err, data) {  
        console.log(err)       
        console.log(data.toString());                       
    });  
}
fun();`
Run Code Online (Sandbox Code Playgroud)

在命令行中输出为

 `c:\files\Sample.exe mode=All`
Run Code Online (Sandbox Code Playgroud)

输出如下

{"ID":"VM-WIN7-64","OS":"Windows 7"}{"ID":"VM-WIN7-32","OS":"Windows 7"}{"ID":"V M-WIN7-32-1","OS":"Windows 7"}{"ID":"VM-WIN7-32-2","OS":"Windows 8"}
Run Code Online (Sandbox Code Playgroud)

如何使用node.js获得上述输出

javascript node.js

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