0

I need to locate a element, I used the following two ways:

$("body.c1 div.c1.c2.c3  div.c4   div.c.c7 ul.cc.c6.c8  li.LoginUrl a")
        .click()

But I have problem with this way, because some CSS styles will change from time to time. So I switched to the following:

$(By.linkText("login")).click()

Since login text is always will be appeared even changing in css style.

Problem: Some tests failed when using the second way, although it would have to do the same work as the first way. All tests worked well using first way.

What is the difference between them?

htmL

<body class="c1">

<div class="c1 c2 c3" id="f">
    <div class="c4">
        <div class="c c7">
            <ul class="cc c6 c8" id="x">
                <li class="LoginUrl"><a href="url" onclick="$('#login').modal('show'); return false;">login</a></li>
            </ul> 
        </div>
    </div>
</div>

Hana90
  • 943
  • 5
  • 17
  • 37

0 Answers0