Mike-Smith Posted September 1, 2016 Share Posted September 1, 2016 I want to click on a few img tag but there is no id or every unique things that i can select one thing which i need and the second problem is in my HTML source has a lot of img tags with same src so it's a big problem but i find a piece of text in on click parameter of img tag which is make a difference, so my case is like as below: This is a right img tag that i want to click but src and class are the same with other img tags, so I can't find a difference, but the piece of code on below is make difference. my scenario: I want click on each img tag which has a below string into it String: ViewSIPTrunkRequest.shtm IMG Tag: <img class="imgColor" onmouseover="this.style.cursor='hand'" onclick="window.open('/pasna/systems/services/html/ViewSIPTrunkRequest.shtm?VIEW_SIP_TRUNK_REQUEST_PK_ID=347', '', 'toolbar=no,status=yes,menubar=yes,scrollbars=yes,resizable=no,directories=no,location=no, width=1000,height=700,left=10,top=0');" src="/pasna/images/view.png" border="0"> Please help me to solve this problem. Thanks a million. Link to comment Share on other sites More sharing options...
AutoBert Posted September 1, 2016 Share Posted September 1, 2016 Have you tryd _IENavigate? Just complete URL: " '/pasna/systems/services/html/ViewSIPTrunkRequest.shtm?VIEW_SIP_TRUNK_REQUEST_PK_ID=347 " (the beginning part) Link to comment Share on other sites More sharing options...
Mike-Smith Posted September 2, 2016 Author Share Posted September 2, 2016 10 hours ago, AutoBert said: Have you tryd _IENavigate? Just complete URL: " '/pasna/systems/services/html/ViewSIPTrunkRequest.shtm?VIEW_SIP_TRUNK_REQUEST_PK_ID=347 " (the beginning part) Auto Bert thanks for your reply but i don't know _IENavigate how may help me, please write me sample or if you want to more information feel free to tell. Link to comment Share on other sites More sharing options...
AutoBert Posted September 2, 2016 Share Posted September 2, 2016 give me URL and i complete this one liner! Link to comment Share on other sites More sharing options...
Mike-Smith Posted September 2, 2016 Author Share Posted September 2, 2016 1 minute ago, AutoBert said: give me URL and i complete this one liner! http://192.168.9.200/pasna/systems/services/html/ViewSIPTrunkRequest.shtm?VIEW_SIP_TRUNK_REQUEST_PK_ID=347 Link to comment Share on other sites More sharing options...
Mike-Smith Posted September 2, 2016 Author Share Posted September 2, 2016 Auto Bert I'm waiting for your reply and i hope it'll be solve a problem. Link to comment Share on other sites More sharing options...
Mike-Smith Posted September 2, 2016 Author Share Posted September 2, 2016 Auto Bert I'm waiting for your reply and i hope it'll be solve a problem. Link to comment Share on other sites More sharing options...
Gianni Posted September 2, 2016 Share Posted September 2, 2016 If I understand the problem, you could use a stopgap like the following to compensate the missing ID expandcollapse popup#include <IE.au3> Local $oIE = _IECreate() ; Create an empty browser Local $sHTML = "" ; since your intanet web server is not accessible from the outside world ; I will create a sample page by script to be embedded in the browser $sHTML &= "<HTML>" & @CRLF $sHTML &= "<HEAD>" & @CRLF $sHTML &= "<TITLE>Hello</TITLE>" & @CRLF $sHTML &= "</HEAD>" & @CRLF ; following image has no ID $sHTML &= '<img src="http://www.w3schools.com/tags/smiley.gif" OnClick="this.src=' & "'http://www.w3schools.com/jsref/smiley.gif'"">" & @CRLF $sHTML &= "</HTML>" _IEDocWriteHTML($oIE, $sHTML) ; write above html in the browser _IEAction($oIE, "refresh") ; You could use something like following way in your script ; --------------------------------------------------------- Local $sTargetString = "school" ; <-- string to search within the image OnClick attribute Local $oImgs Do $oImgs = _IEImgGetCollection($oIE) ; get images collection Sleep(100) Until IsObj($oImgs) ; wait till collection is ready For $oImg In $oImgs ; scan all images $attributes = $oImg.attributes ; attribute collection for each image For $Attribute In $attributes ; scan all attributes ; now chech if the searched string is in this image OnClick attribute If $Attribute.nodeName = "onclick" And StringInStr($Attribute.nodeValue, $sTargetString) Then $oImg.Click ; got our target image, click on it ExitLoop 2 EndIf Next Next ; --------------------------------------------------------- MsgBox(0, "Pause", "Pause") _IEQuit($oIE) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Mike-Smith Posted September 2, 2016 Author Share Posted September 2, 2016 Thanks Chimp but $oImg.click is not work in my case what's your suggestion? Link to comment Share on other sites More sharing options...
AutoBert Posted September 3, 2016 Share Posted September 3, 2016 On 2.9.2016 at 1:30 PM, Mike-Smith said: Auto Bert I'm waiting for your reply and i hope it'll be solve a problem. i thought solving like this: _IENavigate($oIE,'http://192.168.9.200/pasna/systems/services/html/ViewSIPTrunkRequest.shtm?VIEW_SIP_TRUNK_REQUEST_PK_ID=347') Link to comment Share on other sites More sharing options...
Mike-Smith Posted September 6, 2016 Author Share Posted September 6, 2016 Thanks this step is passed but after that I have a HTML table which it has some data and I want to fetch them, after that I have to click on hyper link then PDF file open and I want to extract PDF file data, then insert them to MySQL or SQLite. Please help me to done this project, so my needs are following as below: 1- Get data from HTML table and insert it to sqlite 2- Click on hyper link on HTML table 3- Extract data from PDF file and insert it to SQLite thanks a million Link to comment Share on other sites More sharing options...
mLipok Posted September 6, 2016 Share Posted September 6, 2016 3 hours ago, Mike-Smith said: then PDF file open and I want to extract PDF file data What exactly you want when you say extract PDF file data ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now