TestProject Forum

Unable to locate embedded class ebBtn button

Hi
I have built a test where I have to add manually each test step because i can use record feature. I failed to complete test because it is unable to detect a ebBtn button in a web page
ebBtn button is configured as follow:

  •    <div class="exlibrary-content-bodyHolder ex_scrollbar">*
    
  •        <div class="exlibrary-content-body">*
    
  •   		<div class="exlibrary-Network">*
    
  •   			<div class="elScopingPanel-wTopologyButton">*
    
  •   				<button class="ebBtn" type="button">*
    
  •   					<i class="ebIcon ebIcon_topo"></i>*
    
  •   					<span class="ebBtn-caption" style="margin-left: 3px;">Add Topo Data</span>*
    
  •   				</button>*
    
  •   			</div>*
    


Chrome web tools locator detect for this button element a object with following attributes:

  • button.ebBtn
  • name Add Topo Data
  • role button

I tried multiple option to detect this button element:

  • By.CSSSELECTOR=ebBtn
  • By.CSSSELECTOR=Add Topo Data
  • By.CSSSELECTOR=#ebBtn
  • By.TAGNAME=button.ebBtn
  • By.linkText: Add Topo Data
    but none of them succeed to perform a click on this button object as it can’t locate the button ?

Last option I used was: XPATH:"//button[contains(@class, ‘ebBtn’)]"

TestProject report return error:
Element enm_shm_backupadmin_addtopology
Found by XPATH:"//button[contains(@class, ‘ebBtn’)]"
but click action throw exception telling it can’t found the element

java.util.concurrent.ExecutionException: org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression “//button[contains(@class, ‘ebBtn’)]” because of the following error:

Thanks for any suggestion how to fix this issue

Hello @christian.le.jalle,

Can you try using By.CSSSELECTOR = .ebBtn
Also why can’t you use the record feature to just record the click on the element?

Hi Artem

First Thanks for your time and support ,
I tried your syntax . Unfortunately this filter is not enough because in same window i can have several button suing same class ebBtn …
e.g.:

Create Backup Job Create Restore Job Create Backup Housekeeping Job

So i need to have a syntax with filter able to select with button label or in case of initial button “addTopo” i was able to go through the click action by selecting CSS .ebBtn-caption.
but just to hit next problem with a "flyout panel " with tab panel made of objects like this “search” tab:
"


Search

That i can't detect either ....

About question why i can’t use record feature ?

Reason is because this Web page and server can be accessed with a custom PROXY PAC configuration . So when I wanted to record i was unable to access that site due to proxy not set correctly. With help of Amit from testProject and this link

I was able to use job settings to “push” this proxy configuration . But doing that way i can’t use record feature and i have to design manually step by step the test case and it’s reason for all this syntax issues

Thanks
Christian

Hi
Eventually fixed my issue by using XPATH locator instead of CSS
Retrieve XPATH using CHROME developer tools :

  1. Right click “inspect” on the item you are trying to find the xpath
  2. Right click on the highlighted area on the console.
  3. Go to Copy xpath
    results will be like :
    /html/body/div[3]/div/div[4]/div[1]/div[4]/div/div[2]/div/div[5]/div[4]/div[1]/div[1]/div/button

BR/
Christian