Selenium Beginner Tutorial 9 - How To Make Code MODULAR

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии •

  • @goransavic3437
    @goransavic3437 2 года назад

    You are demonstrating advance teaching/lecturing skills, as it is clear, understandable, simple and methodical. Your skills and tutorials prove your knowledge and how to pass it in a pragmatic approach. Thank you Raghav.

    • @RaghavPal
      @RaghavPal  2 года назад

      Hi Goran, Most welcome, humbled

  • @AzadSingh-zp9ix
    @AzadSingh-zp9ix 3 года назад

    I am addicted to your teaching style , flow , tone and voice. you are an amazing teacher sir.

    • @RaghavPal
      @RaghavPal  3 года назад

      So humbled to see your message Azad, thanks a lot

  • @riteshwankhede3259
    @riteshwankhede3259 7 лет назад +5

    Great !!
    Thanks, Raghav, even I am not expert in JAVA. but while seeing this video, I understood.
    what is function and how to write code in the proper way. going for next one now :)

    • @RaghavPal
      @RaghavPal  7 лет назад +2

      Great Ritesh, Keep learning.

  • @MrAmarSindol
    @MrAmarSindol 6 лет назад

    Excellently Excellent !!, after watching ur 11th tutorial on selenium, i slowly moved to all the videos and learned a lot. Thanks dude !!

    • @RaghavPal
      @RaghavPal  6 лет назад

      Great to know this Amar. Keep learning.

  • @kaustubhbaitule1822
    @kaustubhbaitule1822 6 лет назад +1

    Excellent explanation....!!!!! was looking for this to implement in my project..keep posting such videos....Thanks again.....

    • @RaghavPal
      @RaghavPal  6 лет назад

      Thanks for watching Kaustubh

  • @pvp8875
    @pvp8875 3 года назад

    Thanks Raghav, very good explanation!

  • @GovindYadav-ic1py
    @GovindYadav-ic1py 6 лет назад

    Very helpful...easy to understand & implement

    • @RaghavPal
      @RaghavPal  6 лет назад

      Great to know that Govind

  • @sheetaldheer5954
    @sheetaldheer5954 4 года назад

    excellent , very well explained.

    • @RaghavPal
      @RaghavPal  4 года назад

      Glad it was helpful Sheetal

  • @ehabshaaban4379
    @ehabshaaban4379 4 года назад

    very nice concept! great work

  • @bilalrahaoui191
    @bilalrahaoui191 5 лет назад

    you can create a function with String parameter to choose the browser without changing the source code
    public static void setBrowser(String browserchoice){
    browser=browserchoice;
    }

    • @RaghavPal
      @RaghavPal  5 лет назад +1

      Hi Bilal, yes there are diff ways. I have started from basics.

  • @joevrolijk6197
    @joevrolijk6197 5 лет назад

    Very good!

    • @RaghavPal
      @RaghavPal  5 лет назад

      Thanks for watching Joe

  • @balajikoc1429
    @balajikoc1429 4 года назад

    Sir, how to handle negative testing in automation, please explain. Resources are not available on this topic.

    • @RaghavPal
      @RaghavPal  4 года назад

      Will plan something on this Balaji

  • @sijoalexv
    @sijoalexv 3 года назад

    I tried Modular by myself i have done everything as you said in the video but i come across this error Exception in thread "main" java.lang.NullPointerException
    at FunctionProgram.FunctionCall.runtest(FunctionCall.java:39)
    at FunctionProgram.FunctionCall.main(FunctionCall.java:14)
    if browser = "Firefox" the its working fine but when i changed to Chrome then the above error occurred

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Sijo, will need to see your code and detailed logs. Can try some online help too

    • @sijoalexv
      @sijoalexv 3 года назад

      Hi Raghav, the issue was because else was missing in my second if condition. now its working fine. thanks!

  • @deepakMCA2009knit
    @deepakMCA2009knit 5 лет назад

    While running test on Firefox browser, I don't need the below kind of line ?
    System.setProperty("webdriver.firefox.driver", projectLocation+"\\libs\\firefoxdriver.exe");

    • @RaghavPal
      @RaghavPal  5 лет назад

      Hi Deepak, you can use Webdriver manager for Automatic management of Selenium WebDriver binaries
      github.com/bonigarcia/webdrivermanager

  • @prajunapradeep2348
    @prajunapradeep2348 6 лет назад

    Hi Raghav,
    I have got an error when i try to run with chrome option.Below adding logs :
    Starting ChromeDriver 2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91) on port 13825
    Only local connections are allowed.
    Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
    (Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 138 milliseconds

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Prajuna, have you added chrome driver exe and provided its path. If yes pls post your code here so I can troubleshoot

    • @prajunapradeep2348
      @prajunapradeep2348 6 лет назад

      yes i have added.Please check the below code:
      package test1;
      import org.openqa.selenium.WebDriver;
      import org.openqa.selenium.chrome.ChromeDriver;
      import org.openqa.selenium.firefox.FirefoxDriver;
      import config.properties;
      public class Browserlaunch {
      public static String browser;
      static WebDriver driver;
      public static void main(String[] args)
      {
      //setBrowser();
      properties.readproperties();
      setBrowserConfig();
      runTest();
      properties.writeproperties();
      }
      //public static void setBrowser() {
      //browser="firefox";
      //}
      public static void setBrowserConfig() {
      if(browser.contains("Chrome"))
      {
      System.setProperty("webdriver.chrome.driver","F:\\Java programs\\selenium test script\\lib\\chromedriver\\chromedriver.exe");
      driver= new ChromeDriver();
      }
      if(browser.contains("firefox")) {
      System.setProperty("webdriver.gecko.driver", "F:\\Java programs\\selenium test script\\lib\\gecko driver\\geckodriver.exe");
      System.setProperty("webdriver.firefox.bin","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
      driver= new FirefoxDriver();

      }
      }
      public static void runTest() {
      driver.get("www.twitter.com");
      driver.quit();
      }
      }

    • @RaghavPal
      @RaghavPal  6 лет назад

      Try changing chrome driver version

  • @mornaadams4500
    @mornaadams4500 6 лет назад

    Thank you so much .

    • @RaghavPal
      @RaghavPal  6 лет назад +1

      You're welcome Morna

  • @sajithas6991
    @sajithas6991 3 года назад

    Can I have the link of previous session!!!

    • @RaghavPal
      @RaghavPal  3 года назад

      Sure automationstepbystep.com/

  • @srinivasreddy4136
    @srinivasreddy4136 7 лет назад

    hi ,I am beginner to selenium .i am getting error while to launch chrome web driver.After i down load chrome driver 2.21 ,i extracted folder and i could see only chrome driver application ,but could not found chromedriver.exe file .no where in my pc also.Without chromedriver exe file how can run my selenium code ?
    could u plz help me on this whre to find?

    • @RaghavPal
      @RaghavPal  7 лет назад

      Did you try here - chromedriver.storage.googleapis.com/index.html?path=2.33/

  • @prajunapradeep2348
    @prajunapradeep2348 6 лет назад

    Hi ,
    I got an error while executing the same program.Please help me to find a solution .Below are the logs :
    Exception in thread "main" java.lang.NullPointerException
    at test1.Browserlaunch.runTest(Browserlaunch.java:46)
    at test1.Browserlaunch.main(Browserlaunch.java:16)

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Prajuna, do you have more logs to understand the cause.

    • @prajunapradeep2348
      @prajunapradeep2348 6 лет назад

      HI raghav,
      Thanks a lot for the reply.I got the solution .It's because i have given "=" operator instead of "contains" method

  • @delfin1231000
    @delfin1231000 7 лет назад

    Please, could you make video how to upload the file with Jmeter?

    • @RaghavPal
      @RaghavPal  7 лет назад +1

      Will create a video on it soon.

  • @giselly9773
    @giselly9773 6 лет назад

    Hello Raghav
    I just made my code modular but when I run the application show me an exception, but I can't find where is problem. the console show me this:
    Exception in thread "main" java.lang.NullPointerException
    at test.firstSeleniumTest.runTest(firstSeleniumTest.java:43)
    at test.firstSeleniumTest.main(firstSeleniumTest.java:15)
    and the line 43 is:
    driver.get("seleniumhq.org/");
    and 15:
    runTest();
    Can you help me to find the problem? Thank you

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Giselly, cannot make out the issue with these logs.

    • @pratishthamudgal8566
      @pratishthamudgal8566 5 лет назад

      Hi Giselly, Maybe you gave the wrong spelling of firefox in if condition ( different than the one you gave in browser="" statement.
      I did the same mistake and got the same exception.

  • @noorbasha609
    @noorbasha609 4 года назад

    sir i have a small dout regarding selenium in python linux platform taking a screenshot
    element = driver.find_element_by_id("mstv")
    element.save_screenshot("new.png")
    save_screenshot is not working in linux but it is working fine in windows. any help please anyone here

    • @RaghavPal
      @RaghavPal  4 года назад

      Hi Noor, what is the error you are facing, Also check the path has forward slash / and not backward slashes \\
      stackoverflow.com/questions/44389171/file-path-not-getting-set-using-save-screenshot-for-python-selenium-in-ubuntu

  • @sarkaran
    @sarkaran 5 лет назад

    I do the same code and follow the steps but instead of opening chrome still opening firefox, what is the reason?

    • @RaghavPal
      @RaghavPal  5 лет назад

      Check your code. You must have used Chrome Driver

    • @sarkaran
      @sarkaran 5 лет назад

      @@RaghavPal I found that when i change anything code and run java application it should run the last code ( i saved code, i refreshed) i just need to remove anything from "Referenced Library" and add again!

    • @RaghavPal
      @RaghavPal  5 лет назад

      Should not be the case. If you have added ChromeDriver and chromedriver.exe in your code. When you save and run it should run on chrome. Just check it is running the same class. You can do a right click and run as..

    • @sarkaran
      @sarkaran 5 лет назад

      @@RaghavPal I added because of first time work very well! when you change for example URL save and run again still open the last URL

    • @RaghavPal
      @RaghavPal  5 лет назад

      Will need to see your code and setup

  • @golusulasrikanth7072
    @golusulasrikanth7072 3 года назад

    whenever iam write this program i get nullpointexception

    • @RaghavPal
      @RaghavPal  3 года назад

      will need to debug your code

  • @sajithas6991
    @sajithas6991 3 года назад

    Can I have the link of previous session!!!

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Sajitha, yes can get all from here - automationstepbystep.com/