Error: unable to resolve class WebElement

I’m getting the below error

unable to resolve class WebElement
@ line 28, column 11.
ArrayList<WebElement> wes = WebUiCommonHelper.findWebElements(to , 30)

 

My code is as shown below

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.mobile.keyword.MobileBuiltInKeywords as Mobile
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.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import java.util.jar.JavaUtilJarAccessImpl

//Modify object property of the test object in Object Repository
TestObject to = WebUI.modifyObjectProperty(findTestObject(‘Object Repository/span_Add New Target’), ‘id’,
‘contains’, ‘sidefillNavButton-’, true)

//Find WebElements based on above match condition
ArrayList<WebElement> wes = WebUiCommonHelper.findWebElements(to , 30)

for (WebElement we: wes){
//Compare with regex id pattern
if (we.getAttribute(‘id’).matches(‘sidefillNavButton-\d\d\d\d-btnInnerEl’))
{
WebUI.click(we)
}
}

WebUI.click(findTestObject(‘span_Add New Target’))

WebUI.setText(findTestObject(‘input_targetCaption’), ‘’)

WebUI.click(findTestObject(‘span_Save’))

 

I’m new to katalan studio. Need help to fix this issue

No still i am facing the same problem.

Test Cases/18July_webtesting/Swan-silk__TC01_Add_indent FAILED because (of) Unable to wait for page load (Root cause: org.openqa.selenium.TimeoutException: Timed out after 5 seconds waiting for com.kms.katalon.core.webui.keyword.builtin.WaitForPageLoadKeyword$1@5af9926a
Build info: version: ‘2.53.0’, revision: ‘35ae25b’, time: ‘2016-03-15 17:00:58’
System info: host: ‘Ashwarya-PC’, ip: ‘192.168.1.14’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_102’
Driver info: com.kms.katalon.selenium.driver.CFirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=44.0, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: ea3622ea-aeee-475d-8656-ff1f5f02edf1)

Please add this import statement at the beginning of your test case. You are missing this package.

import org.openqa.selenium.WebElement

3 Likes