Selenium webdriver 如何获取mailview webdriver的价值 亲爱的客户, 来自电话卡的问候 我们已经为您创建了一个新的电话卡帐户。 您的身份验证代码是:125412 单击以下链接并输入身份验证代码以激活您的帐户:。 如果您有任何问题或需要进一步帮助,请与我们联系。 感谢您与我们合作

Selenium webdriver 如何获取mailview webdriver的价值 亲爱的客户, 来自电话卡的问候 我们已经为您创建了一个新的电话卡帐户。 您的身份验证代码是:125412 单击以下链接并输入身份验证代码以激活您的帐户:。 如果您有任何问题或需要进一步帮助,请与我们联系。 感谢您与我们合作,selenium-webdriver,webdriver,Selenium Webdriver,Webdriver,在这个我想要的身份验证代码中,当我单击链接(单击此处)时,我将能够将该代码发送到其他窗口的文本框中 是否可能,如果是的话,代码将是最受欢迎的 谢谢你的建议 这方面的Java代码 <div class="mailview" style="margin-right:18px;"> Dear Customer,<br><br> Greetings from Calling Cards!.<br><br> We've

在这个我想要的身份验证代码中,当我单击链接(单击此处)时,我将能够将该代码发送到其他窗口的文本框中

是否可能,如果是的话,代码将是最受欢迎的

谢谢你的建议

这方面的Java代码

<div class="mailview" style="margin-right:18px;">

    Dear Customer,<br><br>
    Greetings from Calling Cards!.<br><br>

    We've created a new Calling Cards account for you.
    <br><br>
    Your Authentication Code is: 125412 <br><br>
    Click the following link and enter the authentication code to activate your Account: <a href="http://domain.com/Account/CustomerActivation/bedehhhh9ab7-b016h6hf0-4h6h68bf-a9hhh68-5dbd4hh3e77d7d"> Click 

    Here </a>.

    <br>
    <br>

    Please contact us if you have any questions or need further assistance.

     <br><br>Thank you for your business with us!<br>




            </div>

发布您尝试过的内容。感谢您的快速回复,我不知道如何继续…找不到元素:{“方法”:“xpath”,“选择器”:”//div[@class='mailview']“}我甚至尝试使用以下xpath/html/body/div/div/div/text()查找文本[3]…你能提供网页的链接吗?你是否检查过该元素是否在框架内?我使用的是免费邮件服务名称mailinator.com,说明中提供了html代码…我想知道你提供的第一行代码中的元素使用了什么
   WebElement element = driver.findElement(By.xpath("//div[@class='mailview']"));
    Pattern codePattern = Pattern.compile("(.*)(Your Authentication Code is: )(\\d+)(.*)", Pattern.DOTALL | Pattern.MULTILINE);
    Matcher m = codePattern.matcher(element.getText());
    if (m.matches()) {
        String code = m.group(3);
        System.out.println(code);
    }