2017-01-02 12 views
0

動的に変化しているリンクを確認したい。分断器で部分的にリンクを確認するにはどうすればよいですか?

HTMLコード:

<a href="https://..../v2/simCV/similarCVs?uniqId=713c7de2444bd8c078&amp;sid=2089261923" class="fl simCvLink" target="_blank">Similar Resumes 1</a> 

このリンクで「uniqId」と「SID」変数名は、この変数名は分度器に存在するかどうかである私を確認することができますどのようにchanged.Soではありません。 uniqIdsid - ここ

リンクテキストも、あなたは属性値を取得して、IDを検証するためのロジックを構築することができます「と同様レジュメ1」

答えて

0

すなわちを変更します。以下のようなものを試すことができます

element(by.css('.simCvLink')).getAttribute('href').then(function _checkIDs(link) { 
     //This is a pretty basic logic to check if the link has the expected values, but you can improve this with regex and fetch the ID's for better logic 
     expect(link).toContain("713c7de2444bd8c078"); 
    }) 
1
var count = element.all(by.tagName('a')).filter(function(elem,index){ 
       return elem.getAttribute('href').then(function(href){ 
       return href.indexOf('uniqId=713c7de2444bd8c078&amp;sid=2089261923') > -1 
       }) 
      }).count(); 

    if(count) console.log('element is present'); 
関連する問題