Is it possible to select file for input elements?
I have an HTML input element whose type is file:
<input accept="image/*, image/heic, image/heif" aria-label="Add photo" class="bb bc" type="file" name="file1">
Can I select a file to submit for it? It doesn't seem to be available for ElementHandle. In that case, can you add this one?
Do you have an example of how you would expect this to work?
My goal is to automate posting Facebook posts. There is a problem of clicking the "What's on your mind" input, as it seems that the selectors change every time the page is reloaded. I then use the mobile version m.facebook.com. I want to upload image for the posts. Is it possible?
So if I'm reading this right, is the problem just that you can't select it by class because the classes keep shuffling?
If that's the case, other properties are accessible from within CSS selectors that should help you here. The selector syntax for this is [attribute="value"]. You should be able to just grab it by type or aria-label this way.
You can add it to an element the way you would with classes or pseudo-selectors -- input[type="file"] for instance -- but you don't strictly have to, and it doesn't sound like you'd need to specify that for the use case you're describing.