package Ġru . ser ob yan . vk _ photo _ crawler . selenium Ċ Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġorg . openqa . selenium . By Ċ import Ġorg . openqa . selenium . Javascript Executor Ċ import Ġorg . openqa . selenium . WebDriver Ċ import Ġorg . openqa . selenium . WebElement Ċ import Ġorg . openqa . selenium . support . ui . Expected Conditions Ċ import Ġorg . openqa . selenium . support . ui . WebDriver Wait Ċ import Ġru . ser ob yan . vk _ photo _ crawler . di . Config Ċ Ċ fun ĠWebDriver . getElement ( selector : ĠBy , Ġtimeout : ĠLong Ġ= ĠConfig . vk Timeout ): ĠWeb Element Ġ{ ĊĠĠĠ Ġreturn ĠWebDriver Wait ( this , Ġtimeout ) ĊĠĠĠĠĠĠĠ Ġ. until ( Expected Conditions . presence Of Element Loc ated ( selector )) Ċ } Ċ Ċ fun ĠWebDriver . wait Until ( timeout : ĠLong Ġ= ĠConfig . vk Timeout , Ġchecker : Ġsuspend ĠWebDriver . () Ġ-> ĠBoolean ) Ġ{ ĊĠĠĠ ĠWebDriver Wait ( this , Ġtimeout ) ĊĠĠĠĠĠĠĠ Ġ. until Ġ{ Ġrun Blocking Ġ{ Ġchecker () Ġ} Ġ} Ċ } Ċ Ċ fun ĠWebDriver . wait Until Visibility ( selector : ĠBy , Ġtimeout : ĠLong Ġ= ĠConfig . vk Timeout ) Ġ{ ĊĠĠĠ ĠWebDriver Wait ( this , Ġtimeout ) ĊĠĠĠĠĠĠĠ Ġ. until ( Expected Conditions . visibility Of Element Loc ated ( selector )) Ċ } Ċ Ċ fun ĠWebDriver . scroll By ( x : ĠInt Ġ= Ġ 0 , Ġy : ĠInt Ġ= Ġ 1 0 0 0 0 ) Ġ{ ĊĠĠĠ Ġ( this Ġas ĠJavascript Executor ). execute Script (" window . scroll By (${ x }, Ġ${ y }) ") Ċ } Ċ Ċ fun ĠWebDriver . alert ( message : ĠString ) Ġ{ ĊĠĠĠ Ġ( this Ġas ĠJavascript Executor ). execute Script (" alert (` $ message `) ") Ċ }