c# - I want to select dropdown element -
i want click dropdown element. have mentioned element's xpath/css both. giving error "no element found". working on c# on selenium . have given dropdown id first wait dropdown element , clicked gives same error always. idea ???
it depend of available iframe or maybe should switch default content. it's complicated, without code.
any way try code. it's working me:
private static void choosezipcode(iwebdriver wd) { if (!wd.findelement(by.xpath("//td[@id='divshipstatecombo']/select//option[3]")).selected) { wd.findelement(by.xpath("//td[@id='divshipstatecombo']/select//option[3]")).click(); } } // "[3]" position element(id) in drop down menu // or private static void selectelement(iwebdriver wd, string cardtype) { selectelement cardselect = newselectelement(wd.findelement(by.name("cardtype"))); cardselect.selectbytext("visa card"); }
Comments
Post a Comment