Issue while clicking on 'find hotels' using Selenium-Java -
i using selenium (web driver) - java. picked travel site demo of automation. on travel site, @ home webpage, need place following input before submit form.
- provide city name
- date , date to
- click on find hotel button.
i able following:
- done
- done
- unable click on find hotel button.
on 3rd step, whenever clicking on 'find button' through selenium code, redirect page other website (not sure redirection coming).
my question is: doing wrong? below details:
web page source code:
<div class="clear"></div> <div class='multisearchbox' > <div class='clear'></div> </div> <div class="block_bottom"> <div class="bottom"> <button class="search" type="submit">find hotels</button> <input type="hidden" name="passengers" autocomplete="off" value=""> </div> </div> <div class="clear"></div> </form>'
here button code shows in inspect element:
<button class="search" type="submit">find hotels</button>
here code:
public void submitform() { webelement submit = driver.findelement(by.classname("search")); system.out.println(submit.gettext()); submit.submit(); }
i tried following well:
submit.click();
but no luck.
however, getting button label: 'find hotels' in output page gets re-directed other search page.
doing manual click 'find hotels' button on web page works fine.
i tried chrome , firefox, facing same problem.
please see if can help.
you can use following xpath
//button[text() = 'find hotels']
Comments
Post a Comment