简体   繁体   English

如何<nobr>使用 selenium webdriver</nobr>提取里面的动态文本<nobr>?</nobr>

[英]How to extract the dynamic text inside <nobr> using selenium webdriver?

I am trying to fetch the server file name which is in text format in DOM inside a <nobr> tag and I am getting an invoker error.我正在尝试在<nobr>标记内获取 DOM 中文本格式的服务器文件名,但出现调用程序错误。

Error错误

Invokemethod error(source not found)
Need the text to be stored in string using selenium webdriver- "/services/aps/load_files/upload/WireTransfer_BatchImport_CForeignUSD_155342006955_201901250134.csv"

HTML Code HTML代码

<table id="innerTable" class="summaryTable" cellspacing="0" 
  cellpadding="0" style="">
  <tbody>
    <tr
       onclick="updateOID('155341609897','E_IMPORT_FILE_UPLOADED');
       onRowClick();" 
       rowvalues="155341609897E_IMPORT_FILE_UPLOADED" 
       class="summaryRow_Even">
      <td class="summaryCell" nowrap="" style="width: 275px;">
        <nobr 
           style="width:275px;">
             WireTransfer_BatchImport_CForeignUSD.csv&nbsp; 
        </nobr>
      </td>
      <td class="summaryCell" nowrap="" style="width: 631px;">
         <nobr 
            style="width:631px;">
            /services/aps/load_files/upload/WireTransfer_BatchIm 
            port_CForeignUSD_155342006955_201901250134.csv&nbsp; 
         </nobr>
      </td>

What I had tryied so far到目前为止我尝试过的

String text = getDriver().findElement(By.xpath("//*[@id='innerTable']/tbody/tr[1]/td[2]/nobr/text()")).getText();
String text = getDriver().findElement(By.xpath("//*[@id='innerTable']/tbody/tr[1]/td[2]/nobr/text()")).getAttribute("innerHTML");

Also tried,也试过了,

String text = getDriver().findElement(By.xpath("//nobr[contains(text(),'/services/aps/load_files/upload/WireTransfer_BatchImport_CForeignUSD')]")).getAttribute("innerHTML");

Hope this will work //nobr[contains(text(),'/aps')]希望这会起作用 //nobr[contains(text(),'/aps')]

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 <nobr>使用jQuery</nobr>将文本包装在<nobr>标签</nobr>内 - wrap text inside <nobr> tag using jquery 如何使用Selenium Webdriver在标题中插入文本 - how to insert text in header using selenium webdriver 如何使用Java + Selenium WebDriver移动到动态页面的底部 - How to move to bottom of the dynamic page using Java + Selenium WebDriver 如何使用 Selenium 和 Java 提取不在其自身标签内的文本节点的文本? - How to extract the text of a text node that is not inside a tag of its own using Selenium and Java? 如何<nobr>使用JavaScript而不是jQuery</nobr>获取<nobr>td标签内标签</nobr>的值 - How to get the Value for <nobr> tag inside the td tag using javascript not jquery 如何使用webdriver验证从文本字段中提取自动填充值? - How to validate Extract Autopopulate value from text field using webdriver? 使用Selenium Webdriver加载动态URL - Loading dynamic url using Selenium webdriver 如何从Selenium提供的HTML中提取动态文本3204255? - How to extract the dynamic text 3204255 from the html provided through Selenium? 如何使用 Selenium WebDriver 和 Java 从元素中检索文本 - How to retrieve text from an element using Selenium WebDriver and Java 如何使用Selenium Webdriver单击具有特定文本的div? - How do I click a div with a specific text using Selenium Webdriver?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM