简体   繁体   English

如何使用Selenium-IDE显示实际URL

[英]How to display actual URL with Selenium-IDE

(I'm French so sorry for my language...) I want to download PDFs in some sites with Selenium (我是法语,所以对我的语言感到抱歉...)我想在一些使用Selenium的网站上下载PDF

I've already tried with the web-driver alternative but I need to go in approximately 500 urls using Firefox ... So using selenium IDE is way faster and more practical. 我已经尝试过使用Web驱动程序替代方法,但是我需要使用Firefox输入大约500个URL。因此,使用Selenium IDE更快,更实用。 So... I'm on the good page and click on the pdf's url and it opens in another tab. 所以...我在首页上,单击pdf的URL,它在另一个选项卡中打开。 I want to get the url of the other tab. 我想获取其他标签的网址。

Here a part of the TEST.side file within the selenium-IDE code 这是Selenium-IDE代码中TEST.side文件的一部分

     "value": ""
    }, {
      "id": "57a28847-d129-4cd1-b1f2-7ce91fcc0f71",
      "comment": "",
      "command": "click",
      "target": "css=.rows-container:nth-child(5) .CS-icon-pdf",
      "targets": [],
      "value": ""
    }]
  }],
  "suites": [{
    "id": "487d74b6-a424-4166-88a4-dc111ae6b17d",
    "name": "Default Suite",
    "persistSession": false,
    "parallel": false,
    "timeout": 300,
    "tests": ["ec447b0b-b9b3-445f-88bf-fee0abbfcb4f"]
  }],
  "urls": ["some url"],
  "plugins": []
}

I really didn't find any solutions that work 我真的没有找到任何可行的解决方案

So... I'm on the wanted page and click on the pdf's url and it opens in another tab. 所以...我在通缉页面上,单击pdf的URL,它在另一个选项卡中打开。 I want to get the url of the other tab. 我想获取其他标签的网址。

I know there's someone, somewhere, who can help me. 我知道某个地方有人可以帮助我。

So thanks to you random citizen ! 因此,感谢您随机的公民!

Edit: 编辑:

Here the html source . 此处是html I'm looking for the Rapport annuel pdf in the Documents section 我在“ 文档”部分中寻找Rapport annuel pdf

You can use the command store attribute to retrieve the href attribute. 您可以使用命令store attribute来检索href属性。
Here is an example using an xpath : 这是使用xpath的示例:

Selenium IDE存储属性命令

And the documentation of the command: 以及命令的文档:

store attribute attribute locator, variable name 存储属性属性定位符,变量名
Gets the value of an element attribute. 获取元素属性的值。 The value of the attribute may differ across browsers (this is the case for the "style" attribute, for example). 在不同的浏览器中,属性的值可能有所不同(例如,“样式”属性就是这种情况)。

arguments: 参数:
attribute locator - An element locator followed by an @ sign and then the name of the attribute, eg "foo@bar". 属性定位符-元素定位符,后跟@符号,然后是属性名称,例如“ foo @ bar”。
variable name - The name of a variable without brackets. 变量名-不带括号的变量名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM