Jump to content

Unable to click on element having ONLY class


Recommended Posts

  • Developers

@mLipok has a few days vacation and will be starting again during the Saturday graveyard shift. :idiot: 

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks jdelaney for the response. I just tried Send option and it worked, however, I have a concern. While running IE in invisible mode and if I am working on Notepad or Excel or even on SciTE, will it not send those contents into these applications? If yes, how to bypass?

Link to comment
Share on other sites

Nope.  Possibly controlsend, but doubtful.  I know there are some IE methods to 'keydown' and 'keyup'...but have never been able to get them to work.

You'll have to look into that, and see if it works as needed.

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

6 minutes ago, junkew said:

$ie.navigate2 javascript:alert("hello world");

You have to play with single and double quotes around it

Thanks junkew.. but how will your code identify the element? I mean how will it connect to the element and forward the content to it?

Link to comment
Share on other sites

Its not the easiest with javascript but it is the most powerfull one

see also 

 

go to www.google.com and type (do not copy paste without putting javascript: again in front of it)

1. This just gives a messagebox on whatever is already in the search text box (normally empty)

javascript:alert(document.querySelector("input[id='lst-ib']").value);void(0);

2. Put something in the textbox

javascript:document.querySelector("input[id='lst-ib']").value='AutoIt .NET Common Language Runtime (CLR) Framework';void(0);

3. click on the button

javascript:document.querySelector("input[name='btnK']").click();void(0);

 

Above is very powerfull and works in general with all browsers. The only disbenefit can be you have to do a controlsend to your addressbar of the browser. And the nice part with IE.UDF you just can do $IE.Navigate2 

$IE.Navigate2 "javascript:document.querySelector("input[name='btnK']").click();void(0);"

and handle the " in a proper way with chr(34)

 

div class="btntextdiv"

you can write as  div[class='btntextdiv'] for the querySelector.

Just google querySelector / querySelectorAll and you will find enough examples on how to do stuff with selector logic in javascript

Edited by junkew
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...