【发布时间】:2015-12-31 15:25:06
【问题描述】:
请帮助找出这里有什么问题。我尝试使用下面给出的 Xpath,但没有运气。请看图片。
- 我尝试使用自定义 xpath -
xpath("//*[@class=' js flexbox canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths']/body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-draggable']/div[@class='ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix ui-draggable-handle']/span[@class='ui-dialog-title']").getText
这个返回元素未找到错误。但是,当在 Selenium IDE 中给出此 Xpath 时,会识别该对象
- id("ui-id-8").getText - 这个返回空白
【问题讨论】:
-
请edit您的问题并使其可读。此外,切勿将图像用于代码或标记;始终使用格式化为代码的文本。谢谢。
-
嗨..对不起..我对堆栈溢出不太熟悉。因此不知道如何正确格式化。
-
您是否查看了How do I format my posts using Markdown or HTML?上的帮助中心页面
-
嗨..感谢分享链接。但是他们允许 HTML 标签吗?我浏览了链接,发现只允许使用几个标签。或者有没有其他方法可以共享 HTML?
-
将问题简化为minimal reproducible example,并将简化后的 HTML 直接包含在您的问题中,格式为代码。
标签: java selenium xpath extract