How text of <a> tag can be obtained in selenium
문제
<a itemprop="director" href="/name/nm0000116/" onclick="(new Image()).src='/rg/title-overview/director-1/images/b.gif?link=%2Fname%2Fnm0000116%2F';">
James Cameron
</a>
I want "James Cameron" as output, but unfortunately there is no function to get text like getText()
etc. Please help me that how can I get it"
올바른 솔루션이 없습니다
다른 팁
There is Text
property for that purpose:
IWebElement anchor = Driver.FindElementByTagName("a");
string innerText = anchor.Text;
I couldn't locate the method FindElementByTagName(). If you have trouble with that too, maybe this can work.
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.Firefox());
IWebElement anchor = driver.FindElement(By.TagName("a"));
string text = anchor.Text;
제휴하지 않습니다 StackOverflow