কম্পিউটার টিউটোরিয়াল

এক্সপ্লিসিট ওয়েট কী করে?


এক্সপ্লিসিট ওয়েট 웹 পেজের একটি নির্দিষ্ট এলিমেন্টে অ্যাপ্লাই করা হয়। এটি এক্সিকিউশন পজ রাখে যতক্ষণ না কন্ডিশন সেটিসফাই হয়। এক্সপ্লিসিট ওয়েটও একটি ডাইনামিক ওয়েট যেহেতু যদি ওয়েট টাইম ১৫ সেকেন্ড এবং কন্ডিশন (যেমন এলিমেন্ট ক্লিকেবল, ভিজিবল বা সিলেক্টেবল হওয়ার জন্য অপেক্ষা) নির্দিষ্ট সময়ের আগে পূরণ হয়, তবে কন্ট্রোল পরবর্তী ধাপে চলে যাবে।

এক্সপ্লিসিট ওয়েট আরও কাস্টমাইজেবল যেহেতু আমরা কন্ডিশনের জন্য সেট আপ করতে পারি। এক্সপ্লিসিট ওয়েটের কিছু এক্সপেক্টেড কন্ডিশন নিচে -

  • textToBePresentInElement()

    সিনট্যাক্স

    w.until(ExpectedConditions.textToBePresentInElement(By.id(“<<id expression>>“), “Tutorialspoint”));
  • textToBeClickable()

    সিনট্যাক্স

    w.until(ExpectedConditions.textToBeClickable(By.id(“<<id expression>>“)));
  • alertisPresent()

    সিনট্যাক্স

    w.until(ExpectedConditions.alertisPresent())= null);
  • frameToBeAvailableAndSwitchToIt()

    সিনট্যাক্স

    w.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id(“<<frame id >>“)));

এক্সপ্লিসিট ইমপ্লিমেন্টেশন-এ জটিল, কিন্তু এটি এক্সিকিউশন স্পীডে কোনো প্রভাব ফেলে না এবং পেজের একটি নির্দিষ্ট এলিমেন্টে অ্যাপ্লাই হয়।

এক্সপ্লিসিট ওয়েট-এ, সর্বোচ্চ সময় পেলে ElementNotVisibleException থ্রো করা হয়।

উদাহরণ

import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.support.ui.Wait; public class Explictwt {    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";       driver.get(url);       //implicit wait with time in seconds applied to each elements       driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);       //Clicking on Coding Ground link       driver.findElement(By.xpath("//span[text()=’Coding Ground’]")).click();       // explicit wait declaration       WebDriverWait w = new WebDriverWait(driver,10);       // textToBePresentInElement মেথড দিয়ে কন্ডিশন ওয়েট       w.until(ExpectedConditions.textToBePresentInElement(By.xpath("//img[@title=’Whiteboard’]"),”          Whiteboard”));       driver.quit();    } }

  1. এলটিই (LTE) মানে কী?

  2. SNMP কী বোঝায়?

  3. Windows-এ System Restore কী করে?

  4. অ্যান্টিভাইরাস সফটওয়্যার বোঝা: এটি কীভাবে আপনার ডিভাইস রক্ষা করে