2016-05-14 65 views
0

我無法點擊使用Behat/Mink的鏈接。在<span>標籤中有所需的文字,所以也許這可能是原因? 這是我*.feature文件的一部分:無法關注鏈接| Behat/Mink

Scenario: Tryin' to make it freakin' workin' yo! 
Given I am on "/home/" 
And I follow "Test" 
Then I should be on "/test/" 

這是頁面的一部分我試圖把重點放在:

<li id="ApplicationItem_test" class=" " data-placement="right" rel="popover" data-offset="-6" data-content="" data-original-title="test">        
    <a href="/app/tests/e76ee2a8d9094e11b6bb9c928c5d61e3/" data-subscription-id="e76ee2a8-d909-4e11-b6bb-9c928c5d61e3">         
    <i class="picon-money-icon-16"></i> 
    <span class="expand-element">test 
    </span>          
    <div id="nodeCounter_c592e0ce62c849fab427fc9f2a04b557" style="display:inline-block"> 
    </div>       </a>      
</li>        
<script type="text/javascript"> 
    var node = { id: '#nodeCounter_c592e0ce62c849fab427fc9f2a04b557', action: '/app/tests/e76ee2a8d9094e11b6bb9c928c5d61e3/GetSidebarActionCount' }; 
    Access.SideBar.nodesWithCounters.push(node); 
</script> 

這是我得到的錯誤:

And I follow "Test" 
FeatureContext::clickLink() 
Link with id|title|alt|text "Test" not found. (Behat\Mink\Exception\ElementNotFoundException) 

已經嘗試了在互聯網上找到的所有可能的CSS選擇器功能。另外我想知道是否我不應該在這裏使用Selenium的擴展名(因爲JS?)

+0

當我遇到這個問題時,它是因爲前面的步驟有錯誤。只要確保「給定我在/」/ home /「'顯示你所期望的,在步驟上下文中調試並添加'$ this-> getSession() - > getPage() - > getHtml()'以確保該html是正確的,沒有錯誤。 – gvf

+0

令人驚訝的是,你是對的!感謝隊友,喲! – Lubos

回答

0

所以答案是:我不在正確的頁面上。 基本情景應該是獨立的 - 這意味着我以前的會話被燒燬,並且我錯過了一些以前的步驟(例如,登錄)。