selenium webdriver - clicking background-image from css -


is there way click on background image defined in css not part of html tag? need click on div tag has @class=hitlocation.

<ul id="uxfoldertree_uxfoldertree_template_treerootelement" class="ui-tree-root"> <li class="-ui-tree-branch -ui-tree-folder -ui-tree-type-root collapsible" data--selectionmode="none" data-level="0" data-path="0" data-rootid="0" data-parentid="0" data-id="0">   <div class="hitlocation"> 

the css is

.ui-tree .ui-tree-branch.collapsible > .hitlocation { background-image: url("/workarea/frameworkui/images/icons/plus.png"); background-position: 0 center; cursor: pointer; 

not directly, no.

you can either:

  1. simply click hitlocation element. webdriver implicitly clicks center of element, might enough.

  2. use advanced interactions api , specify @ location in element want click.

    for example, clicks @ position [1,1] counting top-left corner of hitlocation element.

    webelement hitlocation = driver.findelement(by.classname("hitlocation")); new actions(driver)     .movetoelement(hitlocation, 1, 1)     .click()     .perform(); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -