Reputation: 639
i need href website link. But is not. How can I invoke
My html code is this...
<a href="https://www.google.com/blabla/blabla/blabla/blablabla" target="_blank">Çekme İşlemini Onayla</a>
My C# code is this...
var link = _driver.FindElement(By.XPath("//*/a[contains(.,'Çekme İşlemini Onayla')]")).Text;
help pls thank you..
Upvotes: 2
Views: 2577
Reputation: 497
You can get by
string strhref = driver.FindElement(By.XPath("//a[contains(.,'Çekme İşlemini Onayla')]")).GetAttribute("href");;
Upvotes: 0
Reputation: 89295
Instead of Text
property, you can use GetAttribute()
method to get an attribute value :
var a = _driver.FindElement(By.XPath("//a[contains(.,'Çekme İşlemini Onayla')]"));
var href = a.GetAttribute("href");
Upvotes: 1