public API_BTOpenZone login(string fileWithLoginDetails) { ie.open(defaultWebPage); if (ie.title("Google")) { "we are already conneted to the internet".info(); } else if (ie.title("BT Openzone")) { "detected BT Openzone page".info(); // get the login details ICredential credential = fileWithLoginDetails.credential("BtOpenZone"); if (credential == null) { credential = ie.askUserForUsernameAndPassword(); } if (credential == null) { "no file with credentials provided, or no credential of type BtOpenZone found".debug(); credential = ie.askUserForUsernameAndPassword(); } var BTOpenZone_UserName = credential.username(); var BTOpenZone_Password = credential.password(); // populate fields and submit form if (ie.hasField("username") && ie.hasField("password")) { "detected BT Openzone login Form".info(); "submitting login details".debug(); ie.field("username").value(BTOpenZone_UserName); ie.field("password").value(BTOpenZone_Password); ie.buttons()[0].click(); if (ie.hasField("username")) { "Login failed, Aborting worklow".error(); return(this); } ie.open(defaultWebPage); if (ie.title("Google").isFalse()) { "Expected Google page did not load".error(); } } } return(this); }
public API_EventBrite logout() { ie.open("http://www.eventbrite.com/signout"); if (ie.title("Online Event Registration – Sell Tickets Online with Eventbrite") && ie.hasLink("Log in")) { "logout ok".info(); } else { "logout failed".error(); } return(this); }