Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java “如何保存我的代码”;完全Scala“;在这个WebDriverWait示例中?_Java_Scala_Selenium_Webdriver_Overriding - Fatal编程技术网

Java “如何保存我的代码”;完全Scala“;在这个WebDriverWait示例中?

Java “如何保存我的代码”;完全Scala“;在这个WebDriverWait示例中?,java,scala,selenium,webdriver,overriding,Java,Scala,Selenium,Webdriver,Overriding,请参阅以覆盖定义…开头的行?我希望它不是Java风格的,而是能够像正常的那样执行driver.findElementByClassName()。但是当我将driver:WebDriver更改为driver:FirefoxDriver时,我会收到关于覆盖的投诉,然后我删除了覆盖,然后收到关于应用的投诉 有什么想法吗?我对Selenium相当了解,但对Java和Scala还是新手(我来自Python背景) 谢谢 import org.junit.{Before, After, Test} impor

请参阅以
覆盖定义…
开头的行?我希望它不是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)
  }
}

从主题中可以明显看出,您来自Python。我的大脑自动将“完全Scala”转换为“scalonic”。