Search in mobile live element

Asked

Viewed 25 times

1

I’m doing test automation in the company where I work, using Java/Selenium and I’m facing a problem when doing automation in the app, because the structure they use here for development is alive, so it always changes the id,xpath or whatever, I wonder if there’s any lib that searches for some living element or something like.

  • Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of this. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in English.

1 answer

0

You can use strings to "hit" the click where you want, based on references that would be the screen size.

Then screen with largura X e altura Y. My mouse goes up to the string 20x 10y and click.

another way would be you using the keyboard tab. Then you would count how many tabs it would take to get to the element you want to click, and then click and write if needed. and so on.

These are the two ways I thought you could use in these cases. I hope I’ve helped.

The following example is shown in this question

function posicao(e) {
    var el = this;
    var coordenadas = el.getBoundingClientRect();
    var res = 
    console.log('posição x', coordenadas.left, 'posição y', coordenadas.top)
}

document.getElementById('meio').addEventListener('click', posicao);
document.getElementById('fundo').addEventListener('click', posicao);
#meio, #fundo {
    background: #ccd;
    padding: 30px;
    position: absolute;
    border: 2px solid #500;
    cursor: pointer;
}

#meio {
    top: 50%;
    left: 50%;
}

#fundo {
    bottom: 0;
    right: 0;
}
<div id="meio"></div>
<div id="fundo"></div>

  • Would you have an example of that, bro? Since it’s mobile I can’t use it with TAB just by coordinates...

  • have an example in javascript

  • 1

    Thanks bro, it helped a lot

  • could vote as useful and mark as the answer, if it is the answer?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.