PHPUnit Selenium从HTML中获取价值

PHPUnit Selenium从HTML中获取价值,php,selenium,phpunit,Php,Selenium,Phpunit,对于这一点我还是很陌生的,我正在努力从HTML中获得一个值。 我正在使用Sebastian Bergmann提供的PHPUnit selenium Web驱动程序 HTML: <div class="col-lg-7 col-md-7"> <input type="text" id="function_function_name" name="function[function_name]" disabled="disabled" class="form-control inp

对于这一点我还是很陌生的,我正在努力从HTML中获得一个值。 我正在使用Sebastian Bergmann提供的PHPUnit selenium Web驱动程序

HTML:

<div class="col-lg-7 col-md-7">
<input type="text" id="function_function_name" name="function[function_name]" disabled="disabled" class="form-control input-sm" value="JOBSTUDENT">
</div>
结果:Echo为空。(因为没有文本,我不知道如何确定值的目标)

然后我找到了关于
getValueText
的信息,但当我尝试使用它时:

$functie = $this->webDriver->findElement(WebDriverBy::id('function_function_name'))->getValueText(); 
我得到了这个结果: PHP致命错误:调用未定义的方法RemoteWebElement::getValueText()

输出将响应“JOBSTUDENT” 我做错了什么/忘记了什么?

我想是getAttribute()

我不确定By::id()是否真的以id或名称为目标。你可以试试这个:

->findelelement(WebDriverBy::id('function[function\u name])

我认为它是getAttribute():

我不确定By::id()是否真的以id或名称为目标。您可以尝试以下方法:


->findelelement(WebDriverBy::id('function[函数名称])

先生,你是一个天使。我会在9分钟内接受它作为答案,就像一个咒语谢谢!先生,你是一个天使。我会在9分钟内接受它作为答案,就像一个咒语谢谢!
$functie = $this->webDriver->findElement(WebDriverBy::id('function_function_name'))->getValueText(); 
$functie = $this->webDriver
               ->findElement(WebDriverBy::id('function_function_name'))
               ->getAttribute('value');