nightwach 使用xpathwu xiao

 

nightwatch run e2e時想要匹配文字內容javascript

可是css selector不能獲得想要的結果,因此使用xpathcss

使用方法:java

1、添加usePath配置git

test_settings: {
    default: {
      selenium_port: 4444,
      selenium_host: 'localhost',
      silent: true,
      globals: {
        devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
      },
      use_xpath: true
    },
    ...
  }

 

2、使用github

browser
        .useCss()
        .url(devServer)
        .waitForElementVisible('#app', 100000)
        .useXpath()
	.click('.//*[contains(concat(" ",normalize-space(@class)," ")," instance-dropdown-template ")]//li//span[contains(normalize-space(),"小型配置")]')
	.useCss()
	.click('.create-top .form-item:nth-child(4) input')
        .end()

  

3、csstopath代碼如何寫app

https://css2xpath.github.io/url

相關文章
相關標籤/搜索