This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.kms.katalon.core.util.KeywordUtil | |
import com.kms.katalon.core.webui.driver.DriverFactory | |
import org.openqa.selenium.By | |
alert_id = 'Isi isian ini.' | |
alert_en = 'Please fill out this field.' | |
def driver = DriverFactory.getWebDriver() | |
def field_login = driver.findElement(By.id('user_email')) | |
def message = WebUI.executeJavaScript("return arguments[0].validationMessage;", Arrays.asList(field_login)) | |
if ((message==alert_id)||(message==alert_en)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.kms.katalon.core.util.KeywordUtil | |
class Hook { | |
def openBrowser() { | |
WebUI.openBrowser(''); | |
WebUI.maximizeWindow(); | |
WebUI.navigateToUrl('https://www.saucedemo.com/'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random | |
import java.util.Collections | |
def getRandomName() { | |
def names = ['john', 'alice', 'bob', 'emma', 'david'] | |
Collections.shuffle(names) | |
return names.first() | |
} | |
def getRandomString(int length) { | |
def characters = ('abcdefghijklmnopqrstuvwxyz0123456789' as char[]).toList() | |
Collections.shuffle(characters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate a random name | |
function generateRandomName() { | |
const firstNames = ["John", "Alice", "Bob", "Emma", "David","Jhony"]; // Add more first names as needed | |
const lastNames = ["Smith", "Johnson", "Doe", "Brown", "Wilson"]; // Add more last names as needed | |
const randomFirstName = firstNames[Math.floor(Math.random() * firstNames.length)]; | |
const randomLastName = lastNames[Math.floor(Math.random() * lastNames.length)]; | |
return `${randomFirstName} ${randomLastName}`; | |
} | |
const randomName = generateRandomName(); | |
// Store the random name in an environment variable |