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.

  1. provide city name
  2. date , date to
  3. click on find hotel button.

i able following:

  1. done
  2. done
  3. 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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -