Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
112
rated 0 times [  117] [ 5]  / answers: 1 / hits: 38145  / 11 Years ago, mon, february 3, 2014, 12:00:00

I've got a div in an HTML Page of which the name is always known and inside this div there is an href, the details of which are not known. It could be the direct child of the parent or it could be a further grandchild. Looks something like this:



<div class=divName>
...
<a href=some url>some text</a>
...
</div>


I know that there will only be one link within this div, so I want to find the one link and click it.



I've tried the following but it doesn't seem to be working:



    element(by.classname('divName')).find('a').click();


Any ideas?


More From » html

 Answers
10
element(by.css('.divName a')).click();


Or the shorter notation:



$('.divName a').click();

[#72755] Sunday, February 2, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
susanajamiep

Total Points: 466
Total Questions: 113
Total Answers: 108

Location: Liberia
Member since Fri, Oct 22, 2021
3 Years ago
susanajamiep questions
Sun, Jun 12, 22, 00:00, 2 Years ago
Mon, Mar 7, 22, 00:00, 2 Years ago
Wed, Jun 10, 20, 00:00, 4 Years ago
Fri, Jan 24, 20, 00:00, 4 Years ago
;