0

This is my source code :

<a onclick="pd(event);" tabindex="0" issprite="true" data-ctl="Icon" 

style="overflow: hidden; background: transparent 

url("webwb/pygridicons_12892877635.png!!.png") no-repeat scroll 0px top; width: 

16px; height: 16px;" name="ManageStakeholder_pyWorkPage_202" 

title="Add a data " data-click="[["doGridAction",

[":event","INSERTAFTER"]],["refresh", ["thisSection","", "", "&=", "", 

",",":event","","pyWorkPage"]]]" data-hover="[["changeStyle",

[":event","background-position:0px -16px;", "1"]]]" 

onmouseover="pega.c.cbe.processBehavior(event, "data-hover")"></a>

I need click to image (pygridicons_12892877635.png). I using Selenium with chromewebdriver and I look at the selection OK but the onclick from "a" HTML balise do not detected the click.

I see this: How to click Onclick Javascript form using Selenium? The solution is click to the text <a ...> text </a> but in my case I do not have any text.

1 Answer 1

0

I find a solution by javascript execution (from java):

import org.openqa.selenium.JavascriptExecutor;

String xpath = "//table[@param_name='SubSectionManage~pzLayout_3']//a[@title='Add a data ']";

((JavascriptExecutor) webDriver).executeScript("document.evaluate(\"" + xpath + "\", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();");

In this example the xpath is the normal xpath. The important element is executeScript (in java) and document.evaluate (in javascript).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.