javascript - Unable to click button in iframe using Webdriver which has property <em unselectable="on"> -


i need click on 'show in full screen mode' button present in our application.

following html content found using firebug

    <iframe class="gwt-frame" src="/designer/editor/?uuid=1cca23be-5a43-4506-962e-b9124d463469&profile=jbpm" domain="bg-sipstage1" style="width: 100%; height: 580px;" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true">     <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">     <html class=" ext-strict x-viewport x-viewport" xmlns="http://www.w3.org/1999/xhtml" xmlns:b3mn="http://b3mn.org/2007/b3mn" xmlns:ext="http://b3mn.org/2007/ext" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:atom="http://b3mn.org/2007/atom+xhtml">     <head profile="http://purl.org/net/erdf/profile">     <body id="jbpmdesigner" class=" ext-gecko x-border-layout-ct x-body-masked" style="overflow: hidden; position: relative;">     <div id="ext-comp-1008" class=" x-panel x-panel-editor-north x-border-panel x-panel-noborder" style="left: 0px; top: 0px; width: 1625px;">     <div id="ext-gen18" class="x-panel-bwrap">     <div id="ext-gen19" class="x-panel-body x-panel-body-noheader x-panel-body-noborder" style="height: 24px; width: 1625px;">     <div id="ext-comp-1014" class="x-panel x-panel-noborder">     <div id="ext-comp-1023" class="x-toolbar x-small-editor" style="height: 19px;">     <table cellspacing="0">     <tr>     <td id="ext-gen299">     <td id="ext-gen307">     <td id="ext-gen315">     <td id="ext-gen323">     <td>     <td id="ext-gen332">     <td id="ext-gen340">     <td id="ext-gen348">     <td id="ext-gen356">     <td id="ext-gen1095">     <td id="ext-gen365">     <td id="ext-gen373">     <td id="ext-gen1092">     <td id="ext-gen382">     <td id="ext-gen390">     <td id="ext-gen484">     <table id="ext-comp-1046" class="x-btn-menu-wrap x-btn x-btn-icon " cellspacing="0" style="width: 36px;"></td>     <td id="ext-gen493"><table id="ext-comp-1048" class="x-btn-menu-wrap x-btn x-btn-icon " cellspacing="0" style="width: 36px;"></td>     <td id="ext-gen502"><table id="ext-comp-1050" class="x-btn-menu-wrap x-btn x-btn-icon " cellspacing="0" style="width: 36px;"></td>     <td id="ext-gen510"><table id="ext-comp-1053" class="x-btn-wrap x-btn x-btn-icon " cellspacing="0" cellpadding="0" border="0" style="width: auto;">     <tbody>     <tr>     <td class="x-btn-left" id="ext-gen736">     <td class="x-btn-center" id="ext-gen755">     <em unselectable="on"><button id="ext-gen512" class="x-btn-text" type="button" style="background-image: url("/designer/images/fullscreen.png");" title="show in full screen mode"> </button>     </em>     </td>     <td id="ext-gen735" class="x-btn-right">     </tr>     </tbody>     </table>     </td> 

i able identify or find 'show in full screen mode' using following xpath's

1) public fullscreen=by.xpath("//[@id='ext-comp-1053']//*/[2]//*");

or

2) public fullscreen=by.xpath("//*[contains(@title, 'show in full screen mode')]");

however unable click button. used following 2 methods tried using .click() method

actions.waitforelement(......fullscreen); actions.movetoelement(.......fullscreen); driver.findelement(........fullscreen).click(); 

even tried using javascript click

webelement fullscreen=driver.findelement(workflowlocators.fullscreen); javascriptexecutor executor2 = (javascriptexecutor)driver;  executor2.executescript("arguments[0].click();", fullscreen);  

in both scenario failing click button.

having nested quotation marks in html tags (like style="background-image: url("/designer/images/fullscreen.png");") might make difficult xpath parse it. consider replacing inner quotations single quotes.

as specific question, should able use simpler method of locating element want click using id of button element. id attributes on web elements should unique in page. try using by.id("ext-gen512").


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -