小编lea*_*g J的帖子

没有id/name的Mink/behat iframe

我必须验证iframe中没有名称/ ID的文本/消息.在探索之后,我发现了添加id/name并使用switchToIFrame(id/name)的解决方案.如何在貂皮中为节点元素设置id/name?SetAttribute()不是nodelement中支持的方法,并且帧不支持setValue().

<html>
  <body>
    <div class="div1">
    <iframe class="xyz">
      <!DOCTYPE html>
      <html>
        <body>
          <div class="frame"></div>
          <p>The paragraph1</p>
        </body>
       </html>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我的上下文文件是

public function iShouldSeeDescription($arg1)
{
    $expected = "The paragraph1";
    $iframe=$this->getSession ()->getPage ()->find ( 'xpath', '//div[contains(@class,"div1")]/iframe[contains(@class,"xyz")]');
    $iframe->setAttribute('id', 'iframe_id');
    $iframeId = $iframe->getAttribute('id');
    $this->getSession()->switchToIframe("$iframeId");
    $actual = $this->getSession()->getPage()->find('xpath', '//div[@class="frame"]/p[1]');
    if ($actual === null) {
        throw new \InvalidArgumentException ( sprintf ( 'null:%s', $arg1 ) );
    }
    if (!($actual === $expected)) {
        throw new \InvalidArgumentException ( sprintf ( 'The Acutal description:%s and expected description:%s did not …
Run Code Online (Sandbox Code Playgroud)

iframe setattribute behat mink

2
推荐指数
1
解决办法
1733
查看次数

打印两个变量 - 从脚本运行时只打印第二个变量

我正在尝试使用shell脚本打印到sting1和string2之间的空格.定义字符串a,b并使用echo打印它们之间的空格.但是,a由b替换如下.

a='30 Jan 2016 22:'
b='30 Jan 2016 23:'
echo $a $b
Run Code Online (Sandbox Code Playgroud)

输出:

30 Jan 2016 23:
Run Code Online (Sandbox Code Playgroud)

String1被string2覆盖以显示.但是,同样的命令提示符如下:

$ a='30 Jan 2016 22:'
$ b='30 Jan 2016 23:'
$ echo $a $b
30 Jan 2016 22: 30 Jan 2016 23:
Run Code Online (Sandbox Code Playgroud)

为什么这些行为有所不同?

string shell concatenation

0
推荐指数
1
解决办法
37
查看次数

标签 统计

behat ×1

concatenation ×1

iframe ×1

mink ×1

setattribute ×1

shell ×1

string ×1