Hi,
I have tried for the last few days to use Katalon Studio’s
“Import Selenium IDE Scripts (Beta)” function to try to import Selenium IDE scripts into
Katalon Studio. I have failed. So, I tried to simply import a Selenium IDE script
into “Katalon Recorder” and then to copy and paste THAT script into Katalon Studio. The following is the top of the code that is generated by Katalon Recorder:
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import internal.GlobalVariable as GlobalVariable
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.thoughtworks.selenium.Selenium
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.WebDriver
import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium
import static org.junit.Assert.*
import java.util.regex.Pattern
import static org.apache.commons.lang3.StringUtils.join
WebUI.openBrowser('https://www.katalon.com/')
def driver = DriverFactory.getWebDriver()
String baseUrl = "https://www.katalon.com/"
selenium = new WebDriverBackedSelenium(driver, baseUrl)
selenium.open("URL of my company's website")
selenium.type("id=_UserName", "ABC")
selenium.type("id=_Password", "123")
selenium.click("id=Submit")
When I run it I receive the following error:
Start action : Statement - selenium.type(“id=_UserName”, “ABC”)
End action : Statement - selenium.type(“id=_UserName”, “ABC”)
Test Cases/RES FAILED because (of) com.thoughtworks.selenium.SeleniumException: Element id=_UserName not found
Katalon seems unable to get to my company’s URL page because its stuck at the beginning. I think the issue has something to do with the imported libraries, but I don’t really understand the libraries well enough. I just go with them. I tried playing with the following part:
WebUI.openBrowser('https://www.katalon.com/')
def driver = DriverFactory.getWebDriver()
String baseUrl = "https://www.katalon.com/"
selenium = new WebDriverBackedSelenium(driver, baseUrl)
I don’t really see why I need it, aside from opening the browser itself, but whether I get rid of it entirely or just adjust it, I always get errors.
Help is much appreciated.