c# - How to check an element is displayed or not based on their style attribute in selenium? -
i guidances on how solve little issue below in selenium.
basically, want check if menu appears. there 2 menus , if @ html code below, menus each contain 'style="display: none"'
attribute. if menu opens up, display changed block
, if it's closed displays changes none
<div class="confirmation-price-summary__price-dropdown js-dropdown-content" style="display: none;"> <div class="confirmation-price-summary__price-dropdown js-dropdown-content"> <div class="confirmation-price-summary__price-dropdown js-dropdown-content"> <div class="confirmation-price-summary__price-dropdown js-dropdown-content"> <div class="confirmation-price-summary__price-dropdown js-dropdown-content"> </div> <div class="confirmation-price-summary__price-item js-dropdown-container" data-is-dropdown-open="false"> <div class="confirmation-price-summary__price-row confirmation-price-summary__price-row--dropdown-trigger js-dropdown-trigger"> <div class="confirmation-price-summary__price-label underline"> <div class="confirmation-price-summary__price">£43.99</div> </div> <div class="confirmation-price-summary__price-dropdown js-dropdown-content" style="display: none;">
now little awkward because there bunch of classes same name think have use ugly xpath determine location of relevant html tags menus now, such below:
public static travelessentialsbasketmenu => by.xpath("/html/body/div[1]/div[3]/div[1]/div[1]/div[3]/div/div/div[2]/div[1]/div[1]");
simply want use selenium in order write 1 method checks if menu open, , method check if menu closed. best way of tackling , can provide example, please?
Comments
Post a Comment