Unable to get webelement using Xpath from Div

I am trying to automate email id creation in O365, using RPA Express. It supposed to be very simple. However, I am getting error, as below:

error

I am using ‘Click Mouse’ action, with Xpath to select the web element. Please refer below xpath I got for the element.

//*[@id=“DashboardWidgetCommonActions”]/div[2]/div/ul/li[1]

Appended below is the O365 screens.

O365O365_ins

Any help would be greatly appreciated.

@Babu_Melepuram6,

please post here the following info:

  • your RPAx version
  • error log (Details > right-click > Copy)
  • your page html code
  • tell us whether your XPath works in browser (when you press Ctrl+F in dev tools)
  • does this error occur in all browsers? (chrome, FF, IE)

Hi Azinchuk,
Thank you for the response!

RPA Express version - 1.1.6

Error log :

Error executing MouseClickAction
com.workfusion.studio.rpa.recorder.model.playback.PlaybackException: Error executing TemplateAction[templateName=MouseClickAction.ftl,id=15,name=Optional[MouseClickAction],parent=10,nextSibling=16,arguments=ActionArguments[button=[1],delay=[20000],imageName=[C:\Users\Administrator\workfusion-workspace\rpae_project\test_xpath\1508555108744-anchor.apng],fullImageName=[1508555108744.png],xsi:type=[recorder:MouseClickAction, recorder:MouseClickAction],pollingInterval=[300],active=[true],actionDetails=[(click left button)],searchInFrames=[false],type=[XPATH],xPath=[//[@id=“DashboardWidgetCommonActions”]/div[2]/div/ul/li[1]/a/div[2]],awaitTimeout=[20000]]]
at com.workfusion.studio.rpa.recorder.model.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:54)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.execute(TemplateAction.java:27)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.execute(TemplateAction.java:14)
at com.workfusion.studio.rpa.recorder.model.playback.player.ActionPlayer.next(ActionPlayer.java:51)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:147)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {“method”:“xpath”,“selector”:"//
[@id=“DashboardWidgetCommonActions”]/div[2]/div/ul/li[1]/a/div[2]"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘8.5.0-SNAPSHOT’, revision: ‘f1952cc50fb5ea2e2c0bbac7506871f69d9ad83c’, time: ‘2017-10-05 15:00:38’
System info: host: ‘RPS’, ip: ‘192.168.82.252’, os.name: ‘Windows Server 2008 R2’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_121’
Driver info: driver.version: unknown
Command duration or timeout: 5.40 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘8.5.0-SNAPSHOT’, revision: ‘f1952cc50fb5ea2e2c0bbac7506871f69d9ad83c’, time: ‘2017-10-05 13:09:55’
System info: host: ‘RPS’, ip: ‘192.168.82.252’, os.name: ‘Windows Server 2008 R2’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_121’
Driver info: com.freedomoss.crowdcontrol.webharvest.selenium.wrapper.RemoteDriverWrapper
Capabilities [{imageSimilarityThreshold=0.8, webdriver.remote.sessionid=fe3d4816-c9d4-4ded-baea-d1f5e459d187, CLOSE_ALL_WINDOWS=false, browserName=universal, takesScreenshot=true, javascriptEnabled=true, SEARCH_ALL_WINDOWS=true, platform=WINDOWS}]
Session ID: fe3d4816-c9d4-4ded-baea-d1f5e459d187
*** Element info: {Using=xpath, value=//[@id=“DashboardWidgetCommonActions”]/div[2]/div/ul/li[1]/a/div[2]}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:331)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:468)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at com.workfusion.rpa.helpers.RPA.getElement(RPA.java:658)
at com.workfusion.rpa.helpers.RPA.$(RPA.java:590)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:151)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:206)
at Script16.run(Script16.groovy:4)
at com.workfusion.studio.rpa.recorder.model.playback.shell.GroovyShellWrapper.executeScript(GroovyShellWrapper.java:34)
at com.workfusion.studio.rpa.recorder.model.playback.player.PlaybackContext.executeScript(PlaybackContext.java:65)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.executeBehavior(TemplateAction.java:34)
at com.workfusion.studio.rpa.recorder.model.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.execute(TemplateAction.java:27)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.execute(TemplateAction.java:14)
at com.workfusion.studio.rpa.recorder.model.playback.player.ActionPlayer.next(ActionPlayer.java:51)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:147)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken
Build info: version: ‘8.5.0-SNAPSHOT’, revision: ‘f1952cc50fb5ea2e2c0bbac7506871f69d9ad83c’, time: ‘2017-10-05 13:09:55’
System info: host: ‘RPS’, ip: ‘192.168.82.252’, os.name: ‘Windows Server 2008 R2’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_121’
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:138)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:331)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:468)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at com.workfusion.rpa.helpers.RPA.getElement(RPA.java:658)
at com.workfusion.rpa.helpers.RPA.$(RPA.java:590)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:151)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:206)
at Script16.run(Script16.groovy:4)
at com.workfusion.studio.rpa.recorder.model.playback.shell.GroovyShellWrapper.executeScript(GroovyShellWrapper.java:34)
at com.workfusion.studio.rpa.recorder.model.playback.player.PlaybackContext.executeScript(PlaybackContext.java:65)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.executeBehavior(TemplateAction.java:34)
at com.workfusion.studio.rpa.recorder.model.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.execute(TemplateAction.java:27)
at com.workfusion.studio.rpa.recorder.model.playback.action.template.TemplateAction.execute(TemplateAction.java:14)
at com.workfusion.studio.rpa.recorder.model.playback.player.ActionPlayer.next(ActionPlayer.java:51)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:147)
at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {“method”:“xpath”,“selector”:"//
[@id=“DashboardWidgetCommonActions”]/div[2]/div/ul/li[1]/a/div[2]"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘8.5.0-SNAPSHOT’, revision: ‘f1952cc50fb5ea2e2c0bbac7506871f69d9ad83c’, time: ‘2017-10-05 15:00:38’
System info: host: ‘RPS’, ip: ‘192.168.82.252’, os.name: ‘Windows Server 2008 R2’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_121’
Driver info: driver.version: unknown
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘8.5.0-SNAPSHOT’, revision: ‘f1952cc50fb5ea2e2c0bbac7506871f69d9ad83c’, time: ‘2017-10-05 13:09:55’
System info: host: ‘RPS’, ip: ‘192.168.82.252’, os.name: ‘Windows Server 2008 R2’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_121’
Driver info: driver.version: unknown
at .FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/ADMINI~1/AppData/Local/Temp/anonymous837141229332620449webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10770)
at .fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Users/ADMINI~1/AppData/Local/Temp/anonymous837141229332620449webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:625)

Page HTML code : attached and uploaded

tell us whether your XPath works in browser (when you press Ctrl+F in dev tools) - Not clear. can you please clarify
does this error occur in all browsers? (chrome, FF, IE) - do not work in any of them. in fact, Open Website action works only in FF, not in Chrome or IE

Thanks again
Babu Melepuramview-source_https___portal.office.com_adminportal_home#_homepage.html (528.1 KB)

Hello,
Any help here?

cannot open your source code - it seems an invalid html

Thanks for replying!

I have attached source code in both .html and .txt format. hopefully, it would readable this time. appended below is the screen shot of O365 userid creation page/div. unable to get input web elements (First Name, Last name, etc…). by xpath method. I tried ‘image’ option. it works for most of the element. however, without xpath method, it is error-prone.

Thanks in advance.
Babu

source.zip (64.4 KB)

source.html (232.8 KB)

@Babu_Melepuram6,

you are using double quotes in XPath attribute, but you need to use single:

//*[@id='DashboardWidgetCommonActions']/div[2]/div/ul/li[1]

or

//*[@id='DashboardWidgetCommonActions']/div[2]/div/ul/li[1]/a/div[2]

@azinchuk

tried as you advised but still the same error.
I attempted several ‘trial-n-error’ methods also, but not yet successful

have you tried different browsers? (IE, FireFox)

@azinchuk

tried with all of them

IE - tdo not get opened at all
Chrome - Crashes, when reaches at step 15(the step, where i am having issues)
FF - Displays error and stops, when reaches step 15. i tried with ‘image’ option and it works, but not always.

Meanwhile, I have upgraded RPA Express to 1.1.7

Thanks
Babu

Get more information regarding XPath in RPA Express here: