unable to click button with element xpath id's objects

HI There , @Katalon Studio

Just used this 2 days ago and i am a huge fan. Love the Vietnamese culture as well. ( Luv the coffee! ) you guys are on a right path for this.

i got an issue on some scripting/recording where it is unable to click on on link button with a href javascript.Hoping perhaps someone or somebody can assist.

Using:
Katalon 4.8 Win64 build 2.
firefox 56 ( **wires **)

Error Log:

10-12-2017 11:04:30 AM - [FAILED] - Unable to click on object 'Object Repository/Extend object/Page_Home/a_Create Report' (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/Extend object/Page_Home/a_Create Report' located by 'By.xpath: id("t_TreeNav_1")/div[@class="a-TreeView-content is-hover"]/a[@class="a-TreeView-label"]' not found)

&

10-12-2017 11:12:02 AM - [FAILED] - Unable to click on object 'Object Repository/Extend object/Page_Home/span_fa icon-add' (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository/Extend object/Page_Home/span_fa icon-add' located by 'By.xpath: //span[count(. | id("t_TreeNav_1")/div[@class="a-TreeView-content is-hover"]/span[@class="fa icon-add"]) = count(id("t_TreeNav_1")/div[@class="a-TreeView-content is-hover"]/span[@class="fa icon-add"])]' not found)

i've tried these below

</>Script

WebUI.waitForElementVisible(findTestObject('Extend object/Page_Home/span_BAB15A (1)'), 0)

WebUI.delay(3)

WebUI.verifyElementClickable(findTestObject('Extend object/Page_Home/span_fa icon-add'))

not_run: CustomKeywords.'clickJS2.clickusingjs2.clickUsingJS2'(findTestObject('Extend object/Page_Home/a_Create Report'),
0)

not_run: WebUI.click(findTestObject('Extend object/Page_Home/a_Create Report'))

not_run: WebUI.clickOffset(findTestObject('Extend object/Page_Home/a_Create Report'), 100, 100)

not_run: CustomKeywords.'clickJS2.clickusingjs2.clickUsingJS2'(findTestObject('Extend object/Page_Home/a_Create Report'), 100, 100)

---------------------------------------------------------------------------------------

Using these Objects

div_a-TreeView-content is-hove

xpath = id("t_TreeNav_1")/div[@class="a-TreeView-content is-hover"]
class = a-TreeView-content is-hover

a_Create Report

xpath = id("t_TreeNav_1")/div[@class="a-TreeView-content is-hover"]/a[@class="a-TreeView-label"]
href =
javascript:apex.navigation.dialog('f?p=123:4:7575820123781::NO:::\u0026p_dialog_cs=lNaIOfjWHa78dUH1Pl--MLMbjWwGSHIBuGliRolCURViYanZb1P282WoWxzf3PtE-5GKPRngVf5hsiBG-thI-Q',{title:'Name your Report',height:'300',width:'500',maxWidth:'960',modal:true,dialog:null},'t-Dialog--wizard',apex.jQuery('#t_Body'));
text Create Report
class a-TreeView-label

span_fa icon-add

xpath= id("t_TreeNav_1")/div[@class="a-TreeView-content is-hover"]/span[@class="fa icon-add"]
class= fa icon-add

-------------------------------------------------------------------------------------


Using JSexecuter

package clickJS2

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.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testcase.TestCaseFactory
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords

import internal.GlobalVariable

import MobileBuiltInKeywords as Mobile
import WSBuiltInKeywords as WS
import WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import org.openqa.selenium.interactions.Actions as Actions
import com.kms.katalon.core.webui.common.WebUiCommonHelper as WebUiCommonHelper
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import org.openqa.selenium.JavascriptExecutor as JavascriptExecutor

public class clickusingjs2 {
@Keyword
def clickUsingJS2 (TestObject to, int timeout) {

    try {
        WebUI.click(to)
    }
    catch (Exception e) {
        WebDriver driver = DriverFactory.getWebDriver()
        WebElement element = WebUiCommonHelper.findWebElement(to, timeout)
        JavascriptExecutor executor = ((driver) as JavascriptExecutor)
        executor.executeScript('arguments[0].click()', element)
    }
    throw(e)
}

---------------------------------------------------------------------------------

So i've used the "click" keyword and the JScriptexecutor. however i am still unable to click the element.Is there any other option where i can be able to click the class or element?

Appreciate the help/assistance

Bern

Tagged:

Comments

Sign In or Register to comment.