0

I am now write some tests with electron-spectron.

After spectrum start my app, I want to check if my video is stopped or not

the code is like

element

<video muted autoplay id='videoContainer' class='video'></video>

test code

.given("",function(){
    //do something
})
.when("",function(){
    //do something
})
.then("the player should stop the program", function() {

    return app.client.someFuncton('//*[@id="videoContainer"]')
        .then(result=>{
            console.log(result)  // suppose to get my video source
        })
})

It seems that webdriverIO doesn't have an API like getElementById that I can use to find my video tag's source.

Do someone have any good idea?

JeffChen
  • 173
  • 2
  • 10

1 Answers1

0

Here is the documentation for selector in WEBDRIVERIO.

If you want to select an object with id or classname you need to use your selector parameters like below.

'#' means you are looking for element with id.

app.client.someFunction('#yourElementsId')

'.' means you are looking for element with class.

app.client.someFunction('.yourElementsClassname')

sayhan
  • 1,168
  • 1
  • 16
  • 22