How to select Whatsapp nodejs + Selenium input

Asked

Viewed 41 times

0

Language in Nodejs + Selenium

I’m making a simple bot in nodejs and Selenium, I just need to be able to select the input to send file but I’m not getting,

It is the first file type input, but I’m not getting an answer because it has 2 input

How can I select one of them? Anyone can help?

function envia_media(fileToSend,typeFile){

    driver.findElement(By.xpath('//div[@title="Anexar"]')).click()
    // var attach = driver.findElement(By.css("input[type='file']"));
    // var attach = driver.findElement(By.xpath("(//input[@type='file'])[0]"))
    
    var buttonInputMidia = driver.findElement(By.xpath("//ul[contains(@class,'_1hhxx')]")); 
    
    
    var inputMidia =   buttonInputMidia.findElement(By.xpath("//input[contains(@type='file')]"));

    ts(3)
    print('clicou')
    inputMidia.sendKeys(fileToSend)
    ts(3)
    var send = driver.findElement(By.xpath('//div[contains(@class,"q2PP6 _3Git-")]'))
    send.click()
}

here is the image of the javascript selection of inputs

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Inputs are visible, and I need to select the "0" first

<input accept="image/*,video/mp4,video/3gpp,video/quicktime" type="file" multiple="" style="display: none;">

but using the code of the above function I can find it but not click because it says that the element does not exist, someone knows how to do??

The input only appears in this setting when clicking the send 'clip' button' inserir a descrição da imagem aqui

No answers

Browser other questions tagged

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