我想使用AppleScript点击这个按钮:但是我不知道如何在JavaScript中找到这个按钮,因为它没有任何id、名称或类:
可以按一下这个按钮吗?
Parten有一个ID,但是我仍然不能使用这个脚本单击它。
to clickID(theId)
tell application "Safari"
do JavaScript "document.getElementById('" & theId & "').click();" in document 1
end tell
end click
我正在尝试从最上面的Safari文档/选项卡获取URL和文档标题。我有一个AppleScript和一个使用AppleScript框架的目标-c版本。
这两个版本对大多数网页都很好,但是当我在全屏模式下打开Youtube视频时,基于脚本桥的版本失败了。苹果的脚本适用于“普通”和全屏Safari窗口。
有人能看到下面的脚本桥代码有什么问题吗?
在这里,代码(我省略了错误检查的简洁性):
AppleScript:
tell application "Safari"
# Give us some time to open video in full-screen mode
dela
我的目标是让在一台osx机器上点击的链接被加载到一台启用了苹果事件的远程电脑上的safari中。为此,我尝试创建一个applescript应用程序,然后将其设置为系统上的默认浏览器。
我的applescript如下所示:
on run argv
set theurl to item 1 of argv
set dest to "eppc://user:password@ipaddress"
tell application "Safari" of machine dest
activate
open loc
我想safari下载并保存一个使用apple automator的网页。在打开Safari窗口的情况下,我在AppleScript编辑器中运行以下脚本:
tell application "Safari"
set URL of document 1 to "http://www.python.org"
delay 6
get document 1
delay 6
save document 1 in "/mydir/" & "python" & ".htm"
我试图让AppleScript从网站上找到一些数据,并将其复制为文本。
但是,有时我会出错:错误“无法获得”correct@data.com\“的文本项2到1”。编号-1728从文本项目2到1的"correct@data.com“
有什么想法吗?
to getInputByClass(theClass, num) -- defines a function with two inputs, theClass and num
tell application "Safari" --tells AS that we are going to use Safari
有办法在applescript的系统对话框上单击OK按钮吗?目前,我已经完成了所有的工作流程,只有关闭对话框部分是缺失的。对话框出现在Safari应用程序(因为我让我的脚本在Safari上工作)时,按钮“停止提醒”点击通过Javascript功能。这是破坏性行动的确认对话框(停止提醒)。
clickId("stop reminders button id") --clicking on button I need
delay 2 -- making sure that dialog has enough time to appear
pressEnterButton(
我很久没有在Xcode上做过Applescript应用了,
以下是我的代码
script AppDelegate
property parent : class "NSObject"
-- IBOutlets
property theWindow : missing value
property myTextField : missing value
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize y
我正在尝试运行applescript。脚本的内容并不重要,但我希望以一定的时间间隔运行它,直到满足特定的条件。例如,我想单击Safari浏览器中的菜单项(如果可用):
我要运行的applescript:
on menuClick()
tell application "System Events"
tell process "Safari"
click menu item "Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
e
我正在编写一个AppleScript脚本,以便在Safari中抓取一个网页,其中有一段我已经挣扎了相当长时间了。
这将返回所需的文本:log (do JavaScript "document.querySelector('h1 > span').innerHTML;" in front document)
但事实并非如此:log (do JavaScript "document.evaluate('//h1/span/text()[normalize-space()]', document.body, null, XPathResu
我需要在Safari,Chrome和Firefox (可选)中读取打开的标签URL,并将它们转换为数组。我使用的是,它支持Python。
这也可以通过调用返回我正在查找的内容的AppleScript来完成。例如,下面这个简单的AppleScript显示了我要查找的内容
tell application "Safari"
get URL of every tab of every window
end tell
现在我该如何从JavaScript或JavaScript调用它(我不知道在Python中是否可行)?
有人有好主意吗?谢谢!
我希望获得视频的当前时间(必须将用户代理设置为iOS 10,iPhone),使用AppleScript或Applescript中的Javascript。
因为可以用此…更改视频位置
tell application "Safari"
do JavaScript "document.getElementsByTagName('video')[0].currentTime = " & 90
end tell
…我以为像这样的…
tell application "Safari"
set ttime to do J
当我在使用applescript的网页上时,我正在尝试点击safari中的一个简单按钮。我有以下代码:
tell application "Safari"
activate
repeat 5 times
do JavaScript "document.all(\"Roll Again\").click()" in document 1
delay 2
end repeat
end tell
然而,当我运行这段代码时,我得到一个错误:“缺少值”。事件日志显示以下结果:
tell applica
我目前正在使用AppleScript来自动化Safari中的一些任务。下面的代码应该将文本框‘ownerValue’的值设置为循环中的项。每当我执行代码时,什么都不会发生。
set countryList to {"BR", "CN"}
repeat with country in countryList
tell application "Safari"
activate
tell document 1
do JavaScript "document.getEle
这是我想点击的网页。
( )
在那里,我想使用AppleScript点击“资产负债表”或“现金流”。
下面是我正在尝试的AppleScript:
tell application "Safari"
activate
do JavaScript "document.getElementsByClassName('t')[3].click();" in front document
end tell
当我尝试AppleScript时,网页上似乎没有错误,但是标记()没有"href",它可能不像我预期的那样工作。我猜页
我编写了一个AppleScript,它可以从网页中获取一些信息(这不是我的),但是该页面最近已经更新,所以我需要的值在阴影DOM中,而不是主DOM中(如Safari的Web检查器所示)。在此之前,我使用这个AppleScript检索值:
set dateText to (do JavaScript "$('input#release_week').attr('value')" in doc) as string
这是操作JavaScript (使用jQuery,因为目标页面这样做):
$('input#release_week')
我有以下包含Javascript的AppleScript:
set buttontext to "Add Option"
set buttonloc to 1
tell application "Safari"
activate
tell window 1
do JavaScript "var buttonTags = document.getElementsByTagName(\"button\");
var searchText = \"" & buttont
我试着在一个AppleScrip里面运行一个Javascript,但是没有joy,并且找不到问题。
如果我在Chrome的控制台上运行Javascript,它会运行得很好,但是当我将它插入到AppleScript中时,它不会做任何事情。
这是我的代码:
set alertReply to display alert "New Build" message "A new build is now available!" buttons ["Cancel", "Show"] default button 2 giving up aft
我想让applescript在Safari选项卡上的一个特殊位置自动单击,我尝试过这个方法:
delay 10
tell application "System Events"
tell application process "Safari"
click (click at {650, 730})
end tell
end tell
但返回错误:单击应用程序进程"Safari“at {650,730} --> error number -1700 from {650,
我想在一个JavaScript中实现一些AppleScript函数。问题是,每次我使用"do JavaScript“时,都会收到一条错误消息,上面写着”预期的行尾但找到了标识符!“。下面这个简单的脚本有什么问题?
tell application "Safari" to open location "www.apple.com"
do javascript "alert('Hello World');"
end tell
这是一个非常简单的例子,我非常肯定是do javascript造成了这个问题。实际上,我想做一个App
我在编码方面是个新手,尤其是在applescript方面。我设法让下面的代码正常工作:
tell application "Safari"
repeat
delay 7.5
set the URL of document 1 to "https://url.com"
delay 2
tell document 1
do JavaScript "document.getElementById(\"id1\").click()"
我想使用谷歌Chrome自动登录到网站()。
我知道如何在Safari中使用Applescript,但我不知道如何为Chrome编写脚本。
这是我用于Safari自动登录的Applescript。我怎么能用Chrome做同样的事情呢?
tell application "Safari"
activate
if URL of document 1 starts with "https://account.nicovideo.jp/login" or URL of document 1 starts with "https://secure
Safari和Chrome可以通过JavaScript通过AppleScript执行
Safari:
tell application "Safari"
open location "http://example.com"
activate
do JavaScript "alert('example');" in current tab of first window
end tell
Chrome:
tell application "Google Chrome"
open lo
我刚开始使用Applescript在雪豹中创建服务。我发现自己经常尝试用Firefox打开Safari中的链接。我知道有方法打开一个网页url与FF,但我想打开任何链接在一个网页内的FF。我认为使用Applescript创建服务可能是个好主意,到目前为止,我发现:
openFirefoxURL("http://www.apple.com/")
on openFirefoxURL(x)
return do shell script "open -a Firefox" & space & quoted form of x
end openFi
我的具体问题中的一般问题是如何与运行中的Applescript进行交互,而不将当前的程序留在其中。它与如何使用Applescript与其他程序交互的问题正好相反。
我需要浏览大量网页,并将它们输入到电子表格中。我在某种程度上自动化了这个过程,使用了一个Applescript,它接受一个网页作为输入,然后一个接一个地打开它的相关链接,然后在对话框中等待单击,然后再继续到下一个。
如果要运行脚本,请使用作为对话框的输入。
--Let the user input the the main webpage
display dialog "Linkzor" default answer
我正在做一个小AppleScript (我的第一次)登录到一个网站。相关代码应该使用JavaScript点击链接屏幕截图中突出显示的提交按钮。
tell application "Safari"
do JavaScript "$('submit-button.btn').click();" in current tab of first window
end tell
然而,我不熟悉JavaScript,也不确定如何识别按钮。当我运行脚本时,来自AppleScript编辑器的控制台只是简单地声明缺少值。
任何帮助都将不胜感激,
斯图尔特
我首先使用Automator运行一个脚本,该脚本打开网页、读取文本和写入excel,但我遇到了一个错误,并在这里发布了一个问题:
现在我发现了如何使用AppleScript进行类似的操作,我的代码如下所示:
to goToWebPage(theWebPage)
tell application "Safari"
activate
set URL of document 1 to theWebPage
end tell
end goToWebPage
goToWebPage("https://coinmarketcap.com/currencies/b
我正在尝试通过Applescript强制注册。有一个表单字段需要电子邮件。我正在成功地将电子邮件添加到表单字段,但它仍然没有被识别为它的“价值”。当我检查元素时,这个值没有被设置。但是,如果我在表单字段中单击并添加一个空格,则可以识别该值。我不确定如何绕过这一点。我尝试过使用focus()、click()、多次击键,无论我做什么,都不会使用Applescript来设置这个值。
set email to the text returned of (display dialog "Enter in Your Email to Validate Your Purchase:" def
我正在尝试编写一个AppleScript,其中包括获取火狐中每个打开的网页的网址。
在Safari (和Chrome)中,这样做非常简单:
tell application "Safari" to return URL of every tab in every window
然而,在我看来,火狐并没有提供真正的AppleScript支持,比如获取任何选项卡或窗口的URL。当我在谷歌上搜索“火狐”和" AppleScript“时,我通常会收到火狐的bug请求,请求恢复AppleScript支持,最后一次更新是在2010年或2011年(比如和)。
那么,我认为火狐不再提供
我无法在do Javascript块中识别applescript变量。以前版本的脚本编辑器似乎识别该变量,但没有识别Yosemite。
set myVar to 123
tell application "Safari"
do Javascript " document.getElementById('filter1FieldValueId').value= dsid ;" in front document
end tell
这是我需要完成的各种任务之一,如果有人可以建议如何在之外给JAVASCRIPT一个变量,那将是非常有帮助的。