Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Applescript if url of tab contains "text" click link


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Code Applescript if url of tab contains "text" click link

this works for what i need it to, but need to add function that will click on link if urloftab contains "300"

the last url of each page ends in "300", so i figure that if I add a function that for every tab it open it will also search to see if url contains "300". if it contains "300" click link to next page.

this right now works , it opens a list of URL's and searches each one for "text", the site im searching only allows for 300 records to be shown at one time, i have to search hundreds of thousands of records. and I would rather not have to manually click the next button every time it reaches the last URL in the list.
and it searches 300 records in about 11 minutes, and i would rather not wait every 11 minutes to click to continue.

i would need it to, while it has tab open and efter it has searched the page itself and saved the URL in the text file, then also search the URL of the tab for "300", if it contains "300" then close tab and click the next link in the current safari page

Code:
on run {input, parameters}
	read (item 1 of input)
	set ps to paragraphs of the result
	set tot to count ps
	tell application "Safari"
		reopen
		activate
	end tell
	repeat with i from 1 to tot
		set p to item i of ps
		if p is not "" then
			try
				tell application "Safari"
					tell front window
						set r to make new tab with properties {URL:p}
						set current tab to r
						delay 1
						if i = tot then exit repeat
						repeat
							delay 1
							
							tell application "Safari"
								activate
								
								--the source code of current Tab
								set sourceOfTab to source of front document
								
								set urlOfTab to URL of front document
								
								if sourceOfTab contains "1/28/2015" then
									
									--copy of the url in textFile
									do shell script "echo " & urlOfTab & " >> ~/text.txt"
									close current tab of front window
									
								else
									close current tab of front window
								end if
							end tell
							
							
							
							get URL of r
						end repeat
					end tell
				end tell
			end try
		end if
	end repeat
end run


this is what the source of the next button contains on the site im searching, i dont know what class or handle or ID or name that it needs to find the link. every link is a little bit different for each batch of 300 records. the only thing that changes is the ahref

Code:
			

	 </table>


<form action="searchresults.asp" method="Post">
<input type="hidden" name="intpage" value="2">

<table width="100%" border="0" cellspacing="0" cellpadding="2">
	<tr>
	
		<td align="center"></td>
		<td align="right"><a href="searchresults.asp?p=2&amp;qs=a&amp;st=2&amp;lqs=ABERNATHY+MARGUERITE+TR+1%2FNCNB&amp;d=False" onmousedown="document.images['Next'].src='images/arrow_rightdown.gif'"><img src="images/arrow_rightup.gif" name="Next" border="0"></a></td>
		</tr>
	
</table>

            </div>
          </td>
        </tr>
      </table>
	</td>
</tr>
</table>


ive been trying to piece it together with some of these, but i keep getting errors, i dont know programming
Code:
tell document 1

        do JavaScript "document.getElementsByClassName('proceed')[0].click()"

    end tell

Code:
tell application "Safari"
    do JavaScript "document.getElementsByClassName(\"lnkDownloadTransactions.lightbox-launcher\").click();" in window 1
end tell

Code:
tell application "Safari"
    activate
    tell document 1
        do JavaScript "document.getElementById('button-id').click();"
    end tell
end tell

Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Applescript to open webpage from list, search for "text"
ilovedoritos
hi guys, its me, doritos guy, I've laid off of the doritos for a while, twas given me stomach problems. you know when you eat 10 family size bags a day it might cause a problem, any-who i appreciated the help from last time when i was trying to script something, now i just have to try to...... Shell Programming and Scripting
2
Shell Programming and Scripting
Applescript to open webpages from list, search for "text"
ilovedoritos
posted this first in the shell area, realized it was wrong area for this, forgive me hi guys, its me, doritos guy, I've laid off of the doritos for a while, twas given me stomach problems. you know when you eat 10 family size bags a day it might cause a problem, any-who i appreciated the help...... OS X (Apple)
0
OS X (Apple)
Have to click "enter" key twice to successfully login
kensview
Hi Guys, When using plink ( plink -ssh $IP) to connect to an AIX box, the password is correct, but always after input the password and click enter I got "access denied", then I am promted for password again, this time no matter what password I give, correct or bad, after I re-click enter, as...... AIX
2
AIX
Using sed to find text between a "string " and character ","
haggismn
Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all...... Shell Programming and Scripting
10
Shell Programming and Scripting
awk command to replace ";" with "|" and ""|" at diferent places in line of file
shis100
Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone...... Shell Programming and Scripting
7
Shell Programming and Scripting

Featured Tech Videos