Protractor-nodejs:如何从 url 中捕获动态文本

Protractor-nodejs : How to capture the dynamic text from the url

我想使用量角器节点从下方 URL 捕获 'PR001-CC001234' js.I 知道如何获取当前 url 并将其存储在变量中。但需要帮助捕获 url.

末尾的动态文本
http://example.com/cont/abc/PR123/region/Locale/01/PR001-CC01234.html?path=/cont/abc/PR123/region/locale/01/PR001-CC01234

你可以做到

const url =
    "http://example.com/cont/abc/PR123/region/Locale/01/PR001-CC01234.html?path=/cont/abc/PR123/region/locale/01/PR001-CC01234";

const parts = url.split("/");
console.log(parts[parts.length - 1]);
//PR001-CC01234