I want to automate the creation of posts via the Meta Business Suite. Logging in via Instagram works great, but once i got to filling in the details of the new post, i encountered a problem: How do i upload images? SendKeys doesn’t work, i prosume because the “button” that you click to get te file choose dialog is actually a div. What do i do?
Here is the html of the div with the event:
<div class="x78zum5 x1iyjqo2">
<div class="x6s0dn4 x78zum5 x1q0g3np xozqiw3 x2lwn1j xeuugli x1iyjqo2 x19lwn94 x1lcm9me x1yr5g0i xrt01vj x10y3i5r x1y1aw1k xwib8y2 xurb0ha x1sxyh0 xo1l8bm xbsr9hj x1v911su">
<div class="x6s0dn4 x3nfvp2 x1q0g3np xozqiw3 x2lwn1j xeuugli x1c4vz4f x19lwn94 x2lah0s xamitd3">
<div class="x3nfvp2 x120ccyz x4s1yf2 x2lah0s" role="presentation">
<div class="xtwfq29" style="width: 16px; height: 16px; mask-image: url("https://static.xx.fbcdn.net/rsrc.php/v3/y4/r/XKthMa8ZECK.png"); mask-position: 0px -953px;">
</div>
</div>
</div>
<div class="x1iyjqo2 xamitd3" data-sscoverage-ignore="true">
<div class="x6s0dn4 x1q0g3np xozqiw3 x2lwn1j x1iyjqo2 xs83m0k x65s2av x78zum5 xeuugli">
<div class="xmi5d70 x1fvot60 xo1l8bm xxio538 xbsr9hj xq9mrsl x1mzt3pk x1vvkbs x13faqbe xeuugli x1iyjqo2" id="js_ab">
Upload from desktop
</div>
</div>
</div>
</div>
</div>
Also, i just realized, it’s the same with all the text boxes, those are also all just many many divs :/
On StackExchange there is this thread, which seems the closest to my problem: Is it possible to automate drag and drop from a file in system to a website in selenium using TestNG
But if i use that code nothing happens, and i don’t know why or what else i can try.
Also in How to upload a file in Selenium WebDriver with no ‘input’ element (or this) it is hinted that the input element is just hidden somewhere and triggered by the click on the div. However, searching the html with in the inspector gives no input elements of type “file” (only radiobuttons or checkboxes, which are other settings i don’t need).
If anyone can see through this and give me a tip that would be awesome!
3