可以使用href属性获取selenium中的链接

问题描述 投票:0回答:1

我尝试了以下来获取Start Onboarding上的链接但不能。

//string webElement = driver.FindElement(By.XPath("/html/body/div/div/div/a")).GetAttribute("href");
var tes = driver.FindElement(By.XPath(@"/html/body/div/div/div/a")).GetAttribute("href");
var web2 = driver.FindElement(By.XPath(@"//a[contains('saa',@href)"));
var web3 = driver.FindElement(By.XPath(@"//a[text()='saa')]/@href"));
var tes2 = driver.FindElement(By.XPath(@"//a[text()='saa')]/@href")).GetAttribute("href");

开始入职

I need to click on Onboarding which point to the link as shown in href in above html code.

请建议我,我失败的地方和我能做的事情。我是硒的新手。提前致谢。

selenium selenium-webdriver automation ui-automation browser-automation
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.