简体   繁体   中英

CssSelector and LinkText

HTML

    <small style="white-space: nowrap;">
    "("
    <a href="../src/left_main.php" target="left">Sprawdź pocztę</a>
    ")"
    </small>

I cant find it by:

driver.FindElement(By.CssSelector("a[href*='/src/left_main.php']")).Click();

And the second thing is:

HTML

<a href="/sq/src/signout.php" target="_top">
Kliknij tutaj, aby się wylogować
</a>

Cant find with that:

driver.FindElement(By.LinkText("Kliknij tutaj, aby się wylogować")).Click();

try this(didnt try, but must work):

driver.FindElement(By.Xpath(".//a[@href='../src/left_main.php']")).Click();

In second example also better to use the same -- xpath.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM