selenium - Dynamic buttons added to the page, don't know how to find the element -


i have complected structure of page , have no idea how find element...

the page contains folders created user, need create folder , click on it, have no idea how find element i've created. structure this:

<div class="row-text" style="width: calc(100% - 84px);">    <span class="row-item-name">     <span class="row-item-link">       <a class="grid-row-element-name">eclipse111</a>     </span>    <span class="row-item-actions hover-child">       <a>share</a><span> | </span><a watchdox-rename="name" watchdox-save-func="rename(element, name)" class="rename-link"><span translate="">rename</span></a>    </span>    </span>    <br>    <span class="row-meta-data">     <span class="creation-date-formatted">today @  10:30 | </span>    <span class="row-email">orgadmin@mailinator.com</span>    </span> </div> <div class="grid-row-buttons">    <div class="row-tools">       <div class="btn-group dropdown" uib-dropdown="">          <button type="button" class="btn btn-default uib-dropdown-toggle clear-button dropdown-toggle" uib-dropdown-toggle="" aria-haspopup="true" aria-expanded="false">             <span class="icon-wd-material-menu"></span>          </button>          <ul uib-dropdown-menu="" class="dropdown-menu-highz contextual-menu dropdown-menu" role="menu">          </ul>       </div>    </div> </div> 

the class="grid-row-element-name" contains name of folder created (each folder has own )....

i have no idea how continue testing cause not able click on folder....

thank you.

try following, since said "grid-row-element-name" has folder name trying using class name in cssselector.

list<webelement> elements = driver.findelements(by.cssselector("a.grid-row-element-name"));         string foldername = null; //name of folder want click.          (webelement ele : elements) { //iterate on loop              if (ele.gettext().equalsignorecase(foldername)) {                 ele.click();//once folder want found go click.             }         }         //or         //to click on last element try         elements.get(elements.size()-1).click(); 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -