Конфигурация страниц:
Код: Выделить всё
@Configuration
public class PageImplConfig {
@Value("${application.url}")
private String url;
@Bean
public IProductDetailsPage pdp() {
if(url.contains("www.somesite.com")) {
return new ProductDetailsPageHG();
} else {
return new ProductDetailsPageDefault();
}
}
}
Код: Выделить всё
@Bean
@Scope("browserscope")
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public WebDriver chromeDriver(){
ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-allow-origins=*");
WebDriverManager.chromedriver().setup();
return new ChromeDriver(options);
}
Код: Выделить всё
public class PdpSteps extends SpringBaseTestNGTest {
@Autowired
protected IProductDetailsPage pdp;
}
Как правильно управлять сеансами?
Подробнее здесь: https://stackoverflow.com/questions/765 ... -with-java