因此,我试图获得一个脚本,它将获得打开选项卡的当前URL,替换URL的一部分,并输入/导航到已替换文本的新URL。
我正在为替换函数以及如何在当前选项卡中启动经过编辑的URL而奋斗。
这是我认为它应该是什么样子的大致想法。如果这有效的话,它将打开一个新的浏览器与新的URL,但我希望它在标签上,我目前在。
是否需要为替换函数的结果设置一个对象?
如果我现在在
abc123.UZ.com/xaxsxa我想去看那页
xyz789.UZ.com/xaxsxa代码:
Browser("Edge").Page("Loan#").WebButton("LoanConditions").Click
Browser("Edge").Page("Loan#).GetROProperty("url")
Result = Browser("Edge").Page("Loan#").GetROProperty("url")
replace (Result,"abc123","xyz789")
Systemutil.Run "Chrome.exe", "Result"发布于 2018-01-03 02:49:51
使用浏览器对象的导航方法。
您只需将最后2行替换为:
Result = replace(Result,"abc123","xyz789")
Browser("Edge").Navigate Result更新(基于注释中提到的问题):
试试这段代码。这还没有经过我的检验。如果对你有用就告诉我。
set odesc = Description.create
odesc("micclass").value = "Browser"
intBefore = Desktop.Childobjects(odesc).count
Browser("Edge").Page("Loan#").WebButton("LoanConditions").Click
Browser("Edge").Page("Loan#").Sync
intAfter = Desktop.Childobjects(odesc).count
if intAfter = intBefore + 1 then
intIndex = intAfter-1
set objBro = Desktop.Childobjects(odesc).item(intIndex)
Result = objBro.getRoProperty("url")
Result = replace(Result,"abc123","xyz789")
objBro.Navigate Result
end ifhttps://stackoverflow.com/questions/48068222
复制相似问题