看到以 开头的行了override def...
吗?我希望它不是 Java 风格,而是能够driver.findElementByClassName()
像往常一样。但是当我更改driver: WebDriver
为时driver: FirefoxDriver
,我收到有关覆盖的投诉,我将其删除,然后我收到有关应用的投诉。
有任何想法吗?我非常了解 Selenium,但对 Java 和 Scala 还是陌生的(我来自 Python 背景)。
谢谢!
import org.junit.{Before, After, Test}
import org.openqa.selenium.support.ui.{WebDriverWait, ExpectedCondition}
import org.openqa.selenium.{By, WebDriver, WebElement}
class WebDriverWaitTesting extends DemoHelpers {
@Before
lazy val driver = adminLogin(setup())
@Test
def CompanySelectorAfterLogin() {
val wait = new WebDriverWait(driver, 10).until(
new ExpectedCondition[WebElement] {
override def apply(driver: WebDriver) = driver.findElement(By.className("company-selector-link"))
}
)
assert(driver.getPageSource() contains "Select Company", "We are not on the Company Selector page")
}
@After
def after() {
tearDown(driver)
}
}