Всем привет у меня вопрос стандартно на FF запускается, при попытке запустить , к примеру, в хроме , появляетс я ошибка ,
пример кода
////////////////////////////////////////
package Remote;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
import org.junit.*;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import static com.thoughtworks.selenium.SeleneseTestBase.assertEquals;
public class Remote
{
private Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome C:\\chromedriver\\chrome.exe", "http://www..com/");
selenium.start();
}
@Test
public void testSelenium() throws Exception {
selenium.open("/");
selenium.click("css=span.arrow");
selenium.click("link=Sign in");
selenium.click("id=usernameInput");
selenium.type("id=usernameInput", "");
selenium.type("id=passInput", "");
selenium.click("//input[@value='enter']");
selenium.waitForPageToLoad("30000");
selenium.click("//input[@value='Sign in']");
selenium.click("css=div.cell.input-block > label.input-block-hint");
selenium.type("id=titlebarUsernameInput", "");
selenium.type("id=titlebarPassInput", "");
selenium.click("//input[@value='Submit']");
selenium.waitForPageToLoad("30000");
assertEquals("loyalty program", selenium.getText("css=h1.strong-title"));
selenium.click("css=img[alt=\"\"]");
selenium.waitForPageToLoad("30000");
selenium.click("link=Ireland");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
если вместо selenium = new DefaultSelenium(“localhost”, 4444, “*chrome C:\chromedriver\chrome.exe”, “http://www…com/”);
вписать selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, “http://www…com/”);
то всё отлично работает
может кто-то подсказать, как можно правильно выполнить этот тест?
и вопрос №2
можно ли вместо selenium.xxxx использовать ООП , чтобы вызывать классы и методы?
К примеру :
HPage 1= new HPage(driver);
Expected hotel = 1.Select_Bloomsbury("Homepage selecting");
Expected calendar = 1.Select_Calendar("Click on calendar");
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
Expected dates = 1.Select_Dates("Select Dates");
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
Expected submit = 1.Click_Search("Submit");
Assert.assertTrue(submit.getName().contains("SELECT 1& 2"));