use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.
the class MobileAdsBaseObject method verifyImgAdLoadedInSlot.
public void verifyImgAdLoadedInSlot(String slotName, String expectedImg) {
scrollToSlotOnMobile(slotName);
WebElement slot = driver.findElement(By.id(slotName));
if (checkIfSlotExpanded(slot)) {
String foundImg = getSlotImageAd(slot);
Assertion.assertStringContains(foundImg, expectedImg);
} else {
throw new NoSuchElementException("Slot is collapsed - should be expanded");
}
PageObjectLogging.log("AdInSlot", "Ad found in slot", true, driver);
}
use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.
the class MobileAdsBaseObject method verifySlotExpanded.
public void verifySlotExpanded(String slotName) {
scrollToSlotOnMobile(slotName);
WebElement slot = driver.findElement(By.id(slotName));
if (checkIfSlotExpanded(slot)) {
PageObjectLogging.log("AdInSlot", "Slot expanded as expecting", true);
} else {
throw new NoSuchElementException("Slot is collapsed - should be expanded");
}
}
use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.
the class ChatPage method isMessageOnChat.
public boolean isMessageOnChat(String message) {
try {
WebElement userPostedMessage = userPostedMessage(message);
wait.forElementVisible(userPostedMessage);
return true;
} catch (TimeoutException | NoSuchElementException ex) {
PageObjectLogging.log("Message on chat not displayed", ex, true);
return false;
}
}
use of org.openqa.selenium.NoSuchElementException in project oxAuth by GluuFederation.
the class DisplaysLogoInLoginPage method displaysLogoInLoginPage.
@Parameters({ "redirectUris", "redirectUri", "sectorIdentifierUri" })
@Test
public void displaysLogoInLoginPage(final String redirectUris, final String redirectUri, final String sectorIdentifierUri) throws Exception {
showTitle("OC5:FeatureTest-Displays Logo in Login Page");
List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE);
String logoUri = "http://www.gluu.org/wp-content/themes/gluursn/images/logo.png";
// 1. Register client
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
registerRequest.setResponseTypes(responseTypes);
registerRequest.setLogoUri(logoUri);
registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse registerResponse = registerClient.exec();
showClient(registerClient);
assertEquals(registerResponse.getStatus(), 200, "Unexpected response code: " + registerResponse.getEntity());
assertNotNull(registerResponse.getClientId());
assertNotNull(registerResponse.getClientSecret());
assertNotNull(registerResponse.getRegistrationAccessToken());
assertNotNull(registerResponse.getClientIdIssuedAt());
assertNotNull(registerResponse.getClientSecretExpiresAt());
String clientId = registerResponse.getClientId();
// 2. Request authorization and receive the authorization code.
List<String> scopes = Arrays.asList("openid", "profile", "address", "email");
String state = UUID.randomUUID().toString();
AuthorizationRequest authorizationRequest = new AuthorizationRequest(responseTypes, clientId, scopes, redirectUri, null);
authorizationRequest.setState(state);
String authorizationRequestUrl = getAuthorizationEndpoint() + "?" + authorizationRequest.getQueryString();
AuthorizeClient authorizeClient = new AuthorizeClient(getAuthorizationEndpoint());
authorizeClient.setRequest(authorizationRequest);
try {
startSelenium();
driver.navigate().to(authorizationRequestUrl);
WebElement logo = driver.findElement(By.xpath("//img[@src='" + logoUri + "']"));
assertNotNull(logo);
} catch (NoSuchElementException ex) {
fail("Logo not found");
} finally {
stopSelenium();
}
}
use of org.openqa.selenium.NoSuchElementException in project oxAuth by GluuFederation.
the class DisplaysPolicyUriInLoginPage method displaysPolicyUrlInLoginPage.
@Parameters({ "redirectUris", "redirectUri", "sectorIdentifierUri" })
@Test
public void displaysPolicyUrlInLoginPage(final String redirectUris, final String redirectUri, final String sectorIdentifierUri) throws Exception {
showTitle("OC5:FeatureTest-Displays Policy in Login Page");
List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE);
String policyUri = "http://www.gluu.org/policy";
// 1. Register client
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
registerRequest.setResponseTypes(responseTypes);
registerRequest.setPolicyUri(policyUri);
registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse registerResponse = registerClient.exec();
showClient(registerClient);
assertEquals(registerResponse.getStatus(), 200, "Unexpected response code: " + registerResponse.getEntity());
assertNotNull(registerResponse.getClientId());
assertNotNull(registerResponse.getClientSecret());
assertNotNull(registerResponse.getRegistrationAccessToken());
assertNotNull(registerResponse.getClientIdIssuedAt());
assertNotNull(registerResponse.getClientSecretExpiresAt());
String clientId = registerResponse.getClientId();
// 2. Request authorization and receive the authorization code.
List<String> scopes = Arrays.asList("openid", "profile", "address", "email");
String state = UUID.randomUUID().toString();
AuthorizationRequest authorizationRequest = new AuthorizationRequest(responseTypes, clientId, scopes, redirectUri, null);
authorizationRequest.setState(state);
String authorizationRequestUrl = getAuthorizationEndpoint() + "?" + authorizationRequest.getQueryString();
AuthorizeClient authorizeClient = new AuthorizeClient(getAuthorizationEndpoint());
authorizeClient.setRequest(authorizationRequest);
try {
startSelenium();
driver.navigate().to(authorizationRequestUrl);
WebElement policy = driver.findElement(By.xpath("//a[@href='" + policyUri + "']"));
assertNotNull(policy);
} catch (NoSuchElementException ex) {
fail("Policy not found");
} finally {
stopSelenium();
}
}
Aggregations