2016-10-17 11 views
-1

のXPathを書き込むことができないと私は、私が試した私はセレンのスクリプトを書いていますし、私はセレンスクリプトを書いています以下のコード

<div id="notification"> 
<div class="success"> 
Success: You have added 
<a href="http://10.207.182.108:81/opencart/index.php?route=product/product&amp;product_id=28">HTC Touch HD</a> to your 
<a href="http://10.207.182.108:81/opencart/index.php?route=checkout/cart"> 
shopping cart</a>!<img class="close" alt="" src="catalog/view/theme/default/image/close.png"></div></div> 
以下のコードのXPathを書くことができないのです以下のスクリプトと成功した場合、成功通知内に表示されているテキストを見つける必要があります。

//Add 1st Products 
    driver.findElement(By.xpath("//input[contains(@onclick, '28')]")).click(); 
    String msg = driver.findElement (By.xpath("//div[@id='notification']/div")).getText(); 
    String expectedmsg="Success: You have added HTC Touch HD to your shopping cart!"; 
    Assert.assertEquals(msg, expectedmsg); 

THe highlighted one is the xpath i need

答えて

1

xptah使用します。それが役立つと

//div[@id='notification']/div[@class='success'] 

希望を。

+0

いいえ、要素を見つけることができないと言っています –

+0

それは働いています..私はタイムアウトの問題があったと思います。 –

関連する問題