1
String ButtonHolder = driver.findElement(By.xpath("//div[@id='block-success']//button")).getAttribute("text");'
System.out.println(ButtonHolder);
HTML
<button class="join-btn explore-flock">Explore Flock</button>
如何檢查的內容從該代碼
告訴你如何試圖按鈕上的文字。也讓我們知道你是什麼意思*檢查內容* – Andersson
String ButtonHolder = driver.findElement(By.xpath(「// div [@ id ='block-success'] // button」))。getAttribute 「文本」); \t \t \t System.out.println(ButtonHolder); 我想檢查網站上的按鈕內容是什麼@Andersson –
可能的重複[如何使用硒獲取WebElement文本](http://stackoverflow.com/questions/37298400/how-to-get-webelement-text -with硒) – JeffC