-3

enter image description here

I want to get the text of attribute value "downloadBatch(studentPreregisterBatch.batchId,0)". Is there any way to do it in selenium?

<span class="wrapped-text">
99 
<a class="blue" title="" data-original-title="Download" data-placement="bottom" rel="tooltip" ng-click="downloadBatch(studentPreregisterBatch.batchId,0)">
</span>

See the image for tag reference Thanks

5
  • you want to fetch 99 ? Commented Oct 16, 2018 at 10:05
  • @cruisepandey No. i want the value of "downloadBatch(studentPreregisterBatch.batchId,0)" Commented Oct 16, 2018 at 10:09
  • downloadBatch() seems like a function. Do you want to take scope of angular element. Commented Oct 16, 2018 at 10:15
  • @ketulmodi What do you mean by ...text of attribute value "downloadBatch(studentPreregisterBatch.batchId,0)"...? Which text exactly? Once you clarify the question reply to the contributor who have Closed the discussion appending the @ character so that he/she is being notified about the question update and the question can be reopened for canonical answers. Commented Oct 16, 2018 at 10:55
  • @DebanjanB i want the value of function downloadBatch(studentPreregisterBatch.batchId,0) Commented Oct 17, 2018 at 5:17

1 Answer 1

0

That is called attribute value, Selenium Provide facility to get the value using getAttribute.

Code :

driver.findElement(By.xpath("//a[@data-original-title='Download']")).getAttribute("ng-click")  

It would return a String, Same you can store it and print it.

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

5 Comments

He wants to get the value from the function :)
@Infern0 : then just extract the string starting from ( and ends at , using your binding language.
let me clarify, (i think) he want to execute the function from attribute value ex: downloadBatch(studentPreregisterBatch.batchId,0) and get the value return from that function.
@Infern0 : Not sure.. Let him get back to us.
@Infern0 Yes you are right i want the value of function downloadBatch(studentPreregisterBatch.batchId,0)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.