5
5
import org .openqa .selenium .By ;
6
6
import org .openqa .selenium .remote .DesiredCapabilities ;
7
7
import org .openqa .selenium .remote .RemoteWebDriver ;
8
+ import org .testng .Assert ;
8
9
import org .testng .ITestContext ;
9
10
import org .testng .annotations .AfterMethod ;
10
11
import org .testng .annotations .BeforeMethod ;
@@ -28,8 +29,9 @@ public class RegisterAccount {
28
29
protected static final By TELEPHONE_INPUT_FIELD = By .id ("input-telephone" );
29
30
protected static final By PASSWORD_INPUT_FIELD = By .id ("input-password" );
30
31
protected static final By CONFIRM_PASSWORD_INPUT_FIELD = By .id ("input-confirm" );
31
- protected static final By PRIVACY_POLICY_CHECKBOX = By .id ("input-agree" );
32
- protected static final By CONTINUE_BUTTON = By .id ("input[type='submit']" );
32
+ protected static final By PRIVACY_POLICY_CHECKBOX = By .cssSelector ("[for='input-agree']" );
33
+ protected static final By CONTINUE_BUTTON = By .cssSelector ("input[type='submit']" );
34
+ protected static final By PAGE_TITLE = By .className ("page-title" );
33
35
private String Status = "failed" ;
34
36
35
37
@ BeforeMethod public void setup (Method m , ITestContext ctx ) throws MalformedURLException {
@@ -62,8 +64,10 @@ public class RegisterAccount {
62
64
driverHelper .sendKeys (TELEPHONE_INPUT_FIELD , number );
63
65
driverHelper .sendKeys (PASSWORD_INPUT_FIELD , number );
64
66
driverHelper .sendKeys (CONFIRM_PASSWORD_INPUT_FIELD , number );
65
- // driverHelper.click(PRIVACY_POLICY_CHECKBOX);
66
- driverHelper .click (CONTINUE_BUTTON );
67
+ driverHelper .click (PRIVACY_POLICY_CHECKBOX );
68
+ driverHelper .submit (CONTINUE_BUTTON );
69
+ driverHelper .waitForVisibility (PAGE_TITLE , 30 );
70
+ Assert .assertTrue (driverHelper .getText (PAGE_TITLE ).equalsIgnoreCase ("Your Account Has Been Created!" ), "Not Registered successfully. Expected : Your Account Has Been Created! but found " + driverHelper .getText (PAGE_TITLE ));
67
71
Status = "Passed" ;
68
72
}
69
73
0 commit comments