【问题标题】:Regex pattern for URL in casperjscasperjs中URL的正则表达式模式
【发布时间】:2015-03-30 18:49:36
【问题描述】:

在 casperJS 中,我正在编写一个测试用例以在弹出窗口中打开一个 URL。

网址看起来像这样

https://api{domain_name}/facilities/{facility_id}/assessments/{assessment_id}/print_preview

我想获取上述 URL 的正则表达式以用于

withPopup(Mixed popupInfo, Function then)

我已经尝试过这些正则表达式模式

  • /assessment/
  • /assessment$/
  • /print_preview/
  • /$print_preview$/

请帮助我为上述 URL 创建正确的正则表达式。

【问题讨论】:

  • 不清楚,您要选择网址的哪一部分...请澄清,或者用它来玩弄您的正则表达式:regex101.com/r/uV5wH5/1
  • 基本格式/语法更正。
  • 我认为 hexerei 软件想说的是,你定义了 {facility_id}{assessment_id} 需要什么样的字符。这些是数字还是字母数字?那些包括其他角色吗?
  • {facility_id} 和 {assessment_id} 始终是整数。我只想要一个可用于在弹出窗口中打开上述 url 的正则表达式。 @hexereisoftware 我想选择这个完整的 URL。

标签: regex testing pattern-matching automated-tests casperjs


【解决方案1】:

我使用了 /assessments/ 并且成功了 :-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-29
    • 2015-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多