Hi everyone, kinda new to Katalon Studio, had several months using Katalon Recorder tho.
I’m trying to open found articles from https://scitechdaily.com/ and I have tried different ways of looping, WebUI commands, extracting the href link as string and then open it, etc. But I’m not getting it right. Help would be much appreciated.
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('')
WebUI.navigateToUrl('https://scitechdaily.com/')
//detect number of found archive articles
WebDriver driver = DriverFactory.getWebDriver()
List<WebElement> archiveArticles = driver.findElements(By.cssSelector(
// selector option 1
//"#main-content > div.archive-list.mh-section.mh-group > article > div.content-thumb.content-list-thumb > a"
// selector option 2
"#main-content > div.archive-list.mh-section.mh-group > article > header > h3 > a"))
println archiveArticles.size()
// First try open each article from the found list
for(WebElement el :archiveArticles) {
//get article's title
println el.getText()
//get article's URL to click
el.getAttribute("href")
el.click()
}
/* Second failed try
Iterator i = archiveArticles.iterator();
while(i.hasNext()) {
WebElement element = i.next();
//link = element.getAttribute("href").toURI().
element.click()
break;
}
Third try
for (WebElement article : archiveArticles) {
link = article.getAttribute("href")
println link
WebUI.openBrowser(link)
WebUI.waitForPageLoad(3)}*/
For the first and second try error log is:
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a href="https://scitechdaily.com/patient-case-strongly-suggests-link-between-pfizer-covid-19-vaccine-and-bells-palsy/" title="Patient Case Strongly Suggests Link Between Pfizer COVID-19 Vaccine and Bell’s Palsy" rel="bookmark">...</a> is not clickable at point (486, 656). Other element would receive the click: <iframe id="aswift_8" name="" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" width="1005" height="124" frameborder="0" src="https://googleads.g.doubleclick.net/pagead/html/r20210712/r20190131/zrt_lookup.html?fsb=1#RS-1-&adk=1812271801&client=ca-pub-1492496027964988&fa=1&ifi=9&uci=a!9&btvi=3" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" style="display: block; margin: 0px auto;" data-google-container-id="a!9" data-google-query-id="CMPEwuis8vECFaDuKAUdr5kCQg" data-load-complete="true"></iframe>
For third try error log is this:
org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?(...) Driver info: driver.version: CChromeDriver(...)