Milchmann wrote: ↑17 May 2022, 07:27
Hi,
i have a problem with contentmenu, right click and different values with and without .cdp.
Can you help me?
Code: Select all
;~ ; https://wiki.selfhtml.org/extensions/Selfhtml/frickl.php/Beispiel:JS-Event-ondblclick.html#view_result
driver.Frame(0)
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelectorAll("#demo").length()
MsgBox % "LineNumber " A_LineNumber " : " driver.CDP.QuerySelectorAll("#demo").length() ; different results, why?
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelectorAll("#demo")[1].DoubleClick() ; doesn`t work
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelectorAll("input").length()
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelector("input").MBDown(2) ; doesn't work right click contentmenu
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelector("input").click() ; work
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelector("input").click(2) ; doesn`t work , i need contentmenu
thanks
Just Fixed Frame Access from CDP, check out example
Code: Select all
#include, Rufaydium.ahk
Chrome := new Rufaydium()
Page := Chrome.getSessionByUrl("https://wiki.selfhtml.org/extensions/Selfhtml/frickl.php/Beispiel:JS-Event-ondblclick.html#view_result")
if !isobject(page)
{
Page := Chrome.NewSession()
Page.Navigate("https://wiki.selfhtml.org/extensions/Selfhtml/frickl.php/Beispiel:JS-Event-ondblclick.html#view_result")
}
MsgBox % "LineNumber " A_LineNumber " : Number of Tags on Main Page : " Page.QuerySelectorAll("*").length()
Page.Frame(0)
MsgBox % "LineNumber " A_LineNumber " : Number of Tags on Frame 1 : " Page.QuerySelectorAll("*").length()
Page.CDP.Document()
MsgBox % "LineNumber " A_LineNumber " : Tags on Main Page by CDP " Page.CDP.QuerySelectorAll("*").length() ; different results, why?
CDPframe := Page.CDP.Getframes() ; this will return with all frames and with irregular serial
Msgbox, % "CDP Consider #Document as Frame `ntherefore Main page`n so Both Frames are inside Var: CDPFrame `n`n CDPFrame.Length() = " CDPframe.length()
for k , frame in CDPframe
MsgBox % "CDP Frame no " k " : Number of Tags : " frame.QuerySelectorAll("*").length() ; from frame 1
Page.ParentFrame()
Page.Quit()
return
following code its actually sends right Click on page but not on browser window, of element,
Code: Select all
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelector("input").MBDown(2) ; doesn't work right click contentmenu
MsgBox % "LineNumber " A_LineNumber " : " driver.QuerySelector("input").click(2) ; doesn`t work , i need contentmenu
You need to do following steps to access right click,
1) Get Element Coordinates using Element.Rect()
2) Get Window Coordinates using Sesssion.Rect()
3) You know what are
A_ScreenHeight and
A_ScreenWidth, It will get little complicated if you have more than 1 screen
4) Calculate Exact Location of element using above information
5)
Send click or
ControlClick to send right click on exact element location on screen
now you will got contentmenu, oh you need to get the latest lib not the release, I will include changing to v1.5.1 but I have to do few testing
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory