WebDriverWait wait = new WebDriverWait(browser, TimeSpan.FromSeconds(60));
wait.Until(ExpectedConditions.ElementExists(By.XPath("//use[@xlink:href='#core_mail']")));
File.WriteAllText("html.txt", browser.PageSource);
that just times out.. and the page loads way before 60 seconds.
svg
has a default namespace . You have to account for it:
//svg:use[@xlink:href='#core_mail']
Or ignore it with local-name()
:
//*[local-name() = 'use' and @xlink:href='#core_mail']
Though, to be fair, you don't have to dive into the markup that deeply, your "email" button is much higher in the tree - see the very first parent element partially visible on the screenshot - that's your desired element you probably want to locate instead.
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.