How to use @FindBy annotation in Selenium for span text?
问题 I want to know what can I do to get the "Apple" text in span element with @FindBy annotation. Thats html code: <span class="ui-cell-data">Apple</span> and I tried something like that: @FindBy(className = "ui-cell-data:Samsung") WebElement customerName; but it didn't work! 回答1: As per the HTML you have shared you may/maynot have been able to get the Apple text within the span element with : @FindBy(className = "ui-cell-data") WebElement customerName; Your code was nearly perfect but the