小编cxy*_*xyz的帖子

href元素的Xpath

我需要点击下面的href元素,它存在于类似的href元素中.

<a id="oldcontent" href="listDetails.do?camp=1865"><u>Re-Call</u></a>
Run Code Online (Sandbox Code Playgroud)

任何人都可以提供xpath点击上面的href链接吗?在此先感谢您的帮助

selenium xpath selenium-rc selenium-webdriver

15
推荐指数
3
解决办法
10万
查看次数

正则表达式匹配10-15位数字

我正在使用下面的正则表达式:

 Pattern testPattern= Pattern.compile("^[1-9][0-9]{14}");
 Matcher teststring= testPattern.matcher(number);

if(!teststring.matches())
{
   error("blah blah!");
}
Run Code Online (Sandbox Code Playgroud)

我的要求是:

  1. 要匹配一个不应该以0开头的10-15位数字,并且所有数字都应该是数字.
  2. 如果输入的10-15位数字以零开头,则teststring与pattern.my验证错误blah blah不匹配.
  3. 我的问题是如果我输入10-15位数字,它不以零开头,那么也会显示验证错误信息.

我在正则表达式中遗漏了什么?

java regex

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

具有相同类型和ID的多个按钮

我是Selenium的新手.以下是我的代码.

<input type="submit" id="button" value="Edit"/>
Run Code Online (Sandbox Code Playgroud)

我有3个具有相同类型,ID和值的按钮.如何点击每个按钮?任何人都可以帮我解决XPath问题吗?

selenium xpath selenium-rc selenium-webdriver

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

Jersey客户端下载并保存文件

我是jersey/JAX-RS实施的新手.请在下面找到我的球衣客户代码下载文件:

 Client client = Client.create();
 WebResource wr = client.resource("http://localhost:7070/upload-0.0.1-SNAPSHOT/rest/files/download");
 Builder wb=wr.accept("application/json,application/pdf,text/plain,image/jpeg,application/xml,application/vnd.ms-excel");
 ClientResponse clientResponse= wr.get(ClientResponse.class);
 System.out.println(clientResponse.getStatus());
 File res= clientResponse.getEntity(File.class);
 File downloadfile = new File("C://Data/test/downloaded/testnew.pdf");  
 res.renameTo(downloadfile);
 FileWriter fr = new FileWriter(res);
 fr.flush();
Run Code Online (Sandbox Code Playgroud)

我的服务器端代码是:

@Path("/download")
    @GET
    @Produces({"application/pdf","text/plain","image/jpeg","application/xml","application/vnd.ms-excel"})
    public Response getFile()
    {

        File download = new File("C://Data/Test/downloaded/empty.pdf");
        ResponseBuilder response = Response.ok((Object)download);
        response.header("Content-Disposition", "attachment; filename=empty.pdf");
        return response.build();
    }
Run Code Online (Sandbox Code Playgroud)

在我的客户端代码中我得到响应200 OK,但我无法将我的文件保存在硬盘上在下面的行中我提到了文件需要保存的路径和位置.不知道这里出了什么问题,任何帮助都会受到赞赏.谢谢!

File downloadfile = new File("C://Data/test/downloaded/testnew.pdf");
Run Code Online (Sandbox Code Playgroud)

java rest jax-rs jersey-2.0

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

如何点击selenium中的<a>标签

下面是我的代码.粘贴我的整个标签

<TR id="oldcontent" bgcolor="#D0D0D0">
<TD  id="oldcontent">Foot-OM</TD>
 <a id="oldcontent" href="ID=22143"><u>Re-Submit</u></a>
 <a id="oldcontent" href="ID=22143"><u>View</u></a>
<TR>
Run Code Online (Sandbox Code Playgroud)

在这里我需要点击带有重新提交文本的标签.问题是href ="ID = 22143",每次执行测试用例时动态生成id值.所以我需要使用文本中的文本点击重新提交标签第一个文本,即Foot-OM.Can任何人都可以提供xpath>

selenium selenium-ide selenium-rc selenium-webdriver

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

正则表达式为10位或11位数

任何人都可以让我知道下面的正则表达式模式的含义?

Pattern p1=Pattern.compile("^1?(\\d{10})");
Pattern p2=Pattern.compile("^1?([1-9])(\\d{9})");
Run Code Online (Sandbox Code Playgroud)

regex

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