Here is what the DOM looks like:
<em class="x-btn-split" unselectable="on" id="ext-gen161">
<button type="button" id="ext-gen33" class=" x-btn-text">
This is what the above element looks like. The Left hand side of the object is the ‘button’ element and the :after element is the right hand side with the arrow which would bring down a dropdown menu when clicked. As you can see that the right hand side has no identifiers whatsoever and that is partially what is making this difficult to do.
I have seen these two links in stackoverflow and have attempted to combine the answers to form my solution, but to no avail.
Here is one my attempts:
string script = "return window.getComputedStyle(document.querySelector('#ext-gen33'),':before')";
js.ExecuteScript("arguments.click(); ", script);
In which I get this error:
System.InvalidOperationException: 'unknown error: arguments.click is not a function
(Session info: chrome=59.0.3071.115)
(Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)'
I’ve also tried using the Actions class in Selenium to move the mouse in reference to the left hand side, similar to this answer as well. I think it may be because I don’t know what the offset is measured in and the documentation doesn’t seem to give any indication. I think it is in pixels??
Actions build = new Actions(Session.Driver);
This attempt seems to click somewhere as it gives no errors, but I’m not really sure where.
I’m attempting to automate Salesforce (Service Cloud) in c# if that helps.
Maybe someone can offer a solution?