selenium webdriver - Not able to find get the text in browser -
<!doctype html> <html lang="en"> <head> <body class="layout-two-column unibet umyaccount"> <div class="tooltip-container"> <div id="tooltip" class="tooltip tooltip-error right-center" style="top: 466px; left: 709px; display: none;"> <div class="tooltip-content gutter-3 icon icon-small icon-error">danish site specific</div> <div class="tooltip-pointer"></div> <div class="tooltip-pointer-decoration"></div> </div> </div> <div id="window"> <div id="container" class="lobby-theme-3"> <header id="header"> <nav id="nav-main"> <div id="no-sub-nav"></div> <div id="main" role="main"> <div class="stack-wrap gutter-col-wrap-2">
tried following text "danish site specific":
//body[contains(@class,'layout-two-column unibet umyaccount')]//div[contains(@id,'tooltip')]//div[contains(@class,'tooltip-content')]
but above not working when tried text through .gettext() call. please help.
this code work charm, keeping code clean, , avoiding problems if decide insert/change classes inside element:
webelement tooltip = driver.findelement(by.id("tooltip")); string textyouneed = tooltip.findelement(by.classname("tooltip-content")).gettext();
Comments
Post a Comment