selenium - How to Click On Group Add Member through facebook -


i want click on group add button of facebook, have not found possible using xpath.

here html button:

<li>   <a      class="_42ft _4jy0 _3-8i _4jy3 _517h _51sy"      role="button"      href="#"      ajaxify="/ajax/groups/members/add_get.php?group_id=1168192579894018&amp;refresh=1"      rel="dialog">       <i class="_3-8_ img sp__lkugkpb9f- sx_e8790e"></i>     add   </a> </li> 

this how have tried click on it:

javascriptexecutor jse1 = (javascriptexecutor)driver; jse1.executescript("document.getelementbyid('gbqfb').click‌​();"); 

you should try using xpath below :-

driver.findelement(by.xpath(".//a[contains(.,'add')]")).click(); 

or

driver.findelement(by.xpath(".//a[normalize-space() = 'add']")).click(); 

Comments