Hi Dear Gintaras,
This code doesn't work since opened the first link. Could you please help me out?
Thanks!
I was planning to extract every music genre in Categories and then create folders for each album and musician then download pdf. I stuck at the square one.
This code doesn't work since opened the first link. Could you please help me out?
Thanks!
// script "Notes-box.com.cs"
//.
script.setup(trayIcon: true, sleepExit: true, exitKey: KKey.MediaStop, pauseKey: KKey.MediaPlayPause);
//..
var w = wnd.find(0, "* - Google Chrome", "Chrome_WidgetWin_1");
var p = new ChromePage(w);
foreach (var e in w.Elm["web:GROUPING", prop: "@style=display: block;"]["LINK"].FindAll()) {
p.Open(e.Value);
500.ms();
}
/// <summary>
/// Opens a web page in Chrome or Edge, and waits until loaded.
/// </summary>
public class ChromePage {
wnd _w;
elm _eAddress, _eReload;
//may need to change these strings. They may depend on your computer's language and browser program version.
///
public static string AddressBarName = "Address and search bar";
///
public static string ReloadButtonName = "**m Reload||Refresh"; //Chrome||Edge
///
public static string ReloadButtonDescription = "**m Reload this page||Refresh (Ctrl+R)";
/// <summary>
/// Finds UI elements for later opening a URL and waiting.
/// </summary>
/// <param name="w">Chrome or Edge window.</param>
public ChromePage(wnd w) {
_w = w;
var e = _w.Elm["TOOLBAR"].Find(1);
_eAddress = e.Elm["TEXT", AddressBarName].Find(1);
_eReload = e.Elm["BUTTON", ReloadButtonName].Find(1);
}
/// <summary>
/// Opens a web page and waits until loaded or stopped.
/// Also activates the browser window and makes the address bar focused.
/// </summary>
/// <param name="url">Web page URL.</param>
/// <param name="secondsTimeout">How long to wait until loaded. The same as with most other "wait for" functions of the automation library (0 infinite, negative no exception).</param>
/// <returns>false if timeout (when <i>secondsTimeout</i> negative).</returns>
/// <exception cref="TimeoutException"></exception>
/// <exception cref="Exception">Exceptions of used functions.</exception>
public bool Open(string url, double secondsTimeout = 60) {
wildex desc = ReloadButtonDescription;
_w.Activate();
_eAddress.Focus(); //must be before setting Value
_eAddress.Value = url;
_w.Send(0x100, (int)KKey.Enter); //WM_KEYDOWN
_w.Send(0x101, (int)KKey.Enter); //WM_KEYUP
100.ms();
return wait.forCondition(secondsTimeout, () => desc.Match(_eReload.Description));
}
}
I was planning to extract every music genre in Categories and then create folders for each album and musician then download pdf. I stuck at the square one.