Hey man! I’m currently working on my personal automation project and have successfully implemented the PC-side automation. Now, I’m looking to extend this to mobile web and I'm exploring how to utilize TestNG parameters (or a similar approach) to initialize different WebDriver configurations for each platform. Ideally, I would like to set the platform-specific parameter directly in the test class to handle the initialization. Below is an example of how my WebDriverFactory code is structured: public static void initializeDriver(String device) { if (driver.get() == null) { ChromeOptions options = new ChromeOptions(); options.addArguments("--disable-search-engine-choice-screen"); if (device.equals("Mobile")) { // Mobile Emulation Map<String, String> mobileEmulation = new HashMap<>(); mobileEmulation.put("deviceName", "iPhone 12 Pro"); options.setExperimentalOption("mobileEmulation", mobileEmulation); WebDriver webDriver = new ChromeDriver(options); webDriver.manage().window().setSize(new Dimension(420, 1000)); driver.set(webDriver); } else { // PC Setup WebDriver webDriver = new ChromeDriver(options); webDriver.manage().window().setPosition(new Point(-2000, 0)); webDriver.manage().window().maximize(); driver.set(webDriver); } } } At this point, I’m encountering some challenges with how to proceed further and would appreciate any guidance or suggestions you may have. Thanks in advance!
@promiseshirindza12602 ай бұрын
The best, Like it
@automateNow2 ай бұрын
Glad it helped!
@AbhishekSingh-ld6ul2 ай бұрын
Explained so nicely, no doubts remaining. Thank you.
@automateNow2 ай бұрын
Yay! You're welcome.
@deso_im2 ай бұрын
Thx a lot
@automateNow12 күн бұрын
My pleasure!
@benkosmarcus2 ай бұрын
Hello, I saw your video titled "How to Save Screenshots to a Word Document in Selenium." I was wondering if it's possible to save screenshots directly to a Word document using Playwright.
@benkosmarcus2 ай бұрын
Good video, can I do the same with playwright?
@benkosmarcus2 ай бұрын
Good video, can I do the same with playwright?
@81modus3 ай бұрын
Hey do you offer 1 on 1 courses?
@automateNow2 ай бұрын
Hi, yes. What are you looking to learn?
@81modus2 ай бұрын
@@automateNow Playwright using C#
@81modus2 ай бұрын
@@automateNow whats the best way to connect?
@automateNow2 ай бұрын
@81modus Unfortunately, I'm not offering courses involving C# at the moment. You can reach me via LinkedIn or Slack. linktr.ee/automateNow
@senanur403 ай бұрын
It was excellent, thank you very much!
@automateNow3 ай бұрын
You're very welcome!
@MahanYT.093 ай бұрын
I activated windows 11 pro free with hwid windows
@automateNow3 ай бұрын
Where you doing a clean install, or you already had another version/copy of Windows?
@SwitchStation3 ай бұрын
I pretty much went with all Corsair as well lol, nice build
@automateNow3 ай бұрын
Nice!
@randomperson-ok9dt3 ай бұрын
Just wondering, Why do you need branded thermal paste? Is there any value?
@automateNow3 ай бұрын
Great question. Based on the little research I did, liquid metal is the best way to go, but I didn't want to go through the hassle of using that. I also learned that there are some less-known/cheaper thermal paste brands that don't perform as well when compared to reputable brands. In the end, I made the choice for peace of mind.
@NeoDon13 ай бұрын
Good choices, good luck.
@automateNow3 ай бұрын
Thanks
@harinipriya67103 ай бұрын
Thank you so muchhhhhhh it's very useful information...
@automateNow3 ай бұрын
You're welcome. Happy to help!
@chinmayk26574 ай бұрын
How to add stacktrace in if actual ==expected else failure with screenshot +throwable(stacktrace) - looking for quick reply
@namratabedare4 ай бұрын
very nice Video ! can I get to know how to export logs to a file or folder ? Thank you in advance
@automateNow4 ай бұрын
Thank you, @namratabedare. Here is a detailed article which can help you export logs to a file.
@NeyomalRebera4 ай бұрын
Can u do one for C# also please?
@debabrataroy36435 ай бұрын
Thank you for all the hard work you do for everyone. Recently I started having problems with soft assert screenshots. I have emailed you with the details. I would deeply appreciate it if you could help me out with this. Thank you again.
@gonzalojaviermolina76595 ай бұрын
hey sir, I know how to extract all the values of the different populations for each country, and what I want to do is add all the populations to obtain the total, but I am not being able to do it. Could you tell me how to do it? because I am getting an error when I want to convert the values from string to float, so I can't add them. Could you show me any solution for this? . Thank you.
@automateNow4 ай бұрын
Hi @gonzalojaviermolina7659, Here is a simple Java program that adds some string values by first removing the commas. Hopefully, this can give you a hit on how to solve your problem. public class StringAddition { public static void main(String[] args) { // Input strings String str1 = "1,429"; String str2 = "10"; String str3 = "0.75"; // Remove commas and convert to double double num1 = Double.parseDouble(str1.replace(",", "")); double num2 = Double.parseDouble(str2); double num3 = Double.parseDouble(str3); // Calculate the total double total = num1 + num2 + num3; // Print the result System.out.println("Total: " + total); } }
@somnathbanerjee20635 ай бұрын
Thank you. It helped me to setup the Java. Keep up the good work.
@automateNow4 ай бұрын
Awesome! You're very welcome, @somnathbanerjee2063.
@fazelamirvahedi39305 ай бұрын
Pretty helpful, thanks for sharing.
@automateNow4 ай бұрын
You're welcome, @fazelamirvahedi3930.
@benfrankie69366 ай бұрын
How can I interact with modal dialogs generated by browser-level pop-ups (like the one for installing Chrome extensions)? I'm searching for a solution to click on "Add to Chrome". Thanks!
@yogs38706 ай бұрын
Thanks very helpful
@automateNow4 ай бұрын
My pleasure, @yogs3870!
@parzivelgamer49787 ай бұрын
Is there any way to right click on a element using webpath ?
@automateNow4 ай бұрын
You can right-click using the Actions API: // Locate the element you want to right-click on WebElement elementToRightClick = driver.findElement(By.xpath("element_locator")); // Initialize Actions class Actions actions = new Actions(driver); // Perform right-click (context click) on the element actions.contextClick(elementToRightClick).perform();
@shrach87 ай бұрын
I think you shoudlve explained the following code: TakeScreenshot screenshot = (TakeScreenshot) driver; File file = screenshot.getScreenshortAs(OutputType.FILE); a bit more in detail.
@automateNow4 ай бұрын
Here is an explanation of the code: TakeScreenshot screenshot = (TakeScreenshot) driver; = TakeScreenshot is an interface in Selenium that provides a method to capture a screenshot. This line of code casts the driver (which is an instance of WebDriver) to the TakeScreenshot interface. This allows you to use the getScreenshotAs method, which is not available directly through the WebDriver interface. File file = screenshot.getScreenshotAs(OutputType.FILE); = getScreenshotAs(OutputType.FILE) is a method of the TakeScreenshot interface that captures the current screenshot and stores it in a File object. OutputType.FILE specifies that the output of the screenshot should be in the form of a File. The method returns a File object that represents the screenshot captured.
@zednic19817 ай бұрын
How to use fixtures files using index.js (now e2e.js), can you please tell me if this possible.
@automateNow4 ай бұрын
Step 1: Place Fixture Files First, place your fixture files (e.g., JSON files) in the `cypress/fixtures` directory. For example, you might have a file named `data.json` with the following content: { "username": "testuser", "password": "password123" } Step 2: Load Fixtures in Your Test In your test file, you can use the `cy.fixture` command to load the fixture data. Here’s an example of how you can use the fixture data in your tests. // cypress/e2e/sample_spec.js describe('My First Test', () => { it('Loads fixture data', () => { // Load the fixture data cy.fixture('data').then((data) => { // Use the fixture data cy.visit('example.com/login'); // Assume there are input fields with id 'username' and 'password' cy.get('#username').type(data.username); cy.get('#password').type(data.password); // Submit the form cy.get('form').submit(); // Assertions can be added here }); }); }); Step 3: Import Fixtures in e2e.js (formerly index.js) In the `e2e.js` file (which replaces `index.js` in newer versions), you can configure Cypress to use your fixtures. Typically, this file is used to set global configurations and behaviors for your tests. // cypress/support/e2e.js // Import commands.js using ES2015 syntax: import './commands' // Alternatively you can use CommonJS syntax: // require('./commands') before(() => { // Load fixture data globally if needed cy.fixture('data').as('testData'); }); beforeEach(function() { // You can access the fixture data in your tests like this cy.get('@testData').then((data) => { this.data = data; }); }); Step 4: Using Global Fixture Data in Tests With the setup in `e2e.js`, you can now access the fixture data in your tests as `this.data`. // cypress/e2e/sample_spec.js describe('My First Test', function() { it('Uses global fixture data', function() { // Use the globally loaded fixture data cy.visit('example.com/login'); // Assume there are input fields with id 'username' and 'password' cy.get('#username').type(this.data.username); cy.get('#password').type(this.data.password); // Submit the form cy.get('form').submit(); // Assertions can be added here }); }); Tips: - Make sure the paths to your fixture files and other configurations are correct. - You can use different types of fixture files (e.g., JSON, CSV, etc.) as needed for your tests.
@malkedivamshi61768 ай бұрын
I have been searching for this one, finally found it. Thank you so much..
@automateNow7 ай бұрын
Excellent! You're very welcome.
@ajinxRGB8 ай бұрын
Very helpful content !!
@automateNow7 ай бұрын
Thanks. Happy to help! 🙂
@ajinxRGB8 ай бұрын
Amazing explanation !! Learning so much from you !!
@automateNow7 ай бұрын
Thanks for your feedback. Happy to help!
@VikramJamdade-k7j8 ай бұрын
The method executeCdpCommand(String, Map<String,Object>) is undefined for the type DevTools getting error
@automateNow4 ай бұрын
What Selenium version are you using?
@priteshschhajed8 ай бұрын
Thank you! Really helped.
@automateNow8 ай бұрын
You're welcome. Happy to help!
@etc_ayushprasad50808 ай бұрын
Hey can anybody help me my clone button is greyed/ disable not able to clone please help me
@automateNow8 ай бұрын
It sounds like a permissions issue. Are you trying to clone a public repo?
@pdoamila8 ай бұрын
Superb explanation
@automateNow8 ай бұрын
Thank you. :)
@ayushgoyal98718 ай бұрын
I followed the same approach but in some cases, ThreadLocal instances are getting disposed of before closing the web driver, any suggestions?
@automateNow8 ай бұрын
I'd recommend that if you are using Java, use try-with-resources to ensure that resources such as WebDriver instances are closed properly, even in the presence of exceptions. Example: try (WebDriver driver = new ChromeDriver()) { // your code } I'd also suggest that you add logging so that you can have a better understanding of what may be causing the unexpected behavior.
@ayushgoyal98718 ай бұрын
@@automateNow I am using C#, and ThreadLocal for parallel testing
@automateNow8 ай бұрын
It looks like there is no equivalent to Java's try-with-resources in C#. However, you may be able to use a "using" statement for resource management.
@jasoncot7779 ай бұрын
Excellent video, you have a talent for teaching, you always break it down so well. Thanks for making this.
@automateNow8 ай бұрын
Thanks. Glad you found it helpful!
@Balisonglover10 ай бұрын
i dont have the automation folder -_-
@automateNow8 ай бұрын
You don't need to have an "automation" folder. A repo can be cloned into any folder, including the C drive (if you're on Windows).
@azizahasan612010 ай бұрын
the course is really useful thanks, but I have an issue when the framework is bigger the setup() takes to much, do you have a solution for that? thanks
@automateNow8 ай бұрын
You're welcome! Are you referring to the fact that you must keep adding any new page object to the setup method?
@azizahasan61208 ай бұрын
@@automateNowyes what is the other solution?
@azizahasan61208 ай бұрын
When you have 100 pages this will take time because it will setup every single page before the test start
@zlatan21710 ай бұрын
Thanks a bunch 😀
@automateNow10 ай бұрын
Happy to help!
@bhaminibahl480710 ай бұрын
I am still unable to get the screenshot on the report
@automateNow8 ай бұрын
That sounds like a file path issue. Double-check that you're using the correct path. You can also use some logging to print the filepath and make sure it's correct.
@49283210 ай бұрын
Thank you. First I tried "disable-infobars" option and it didn't work. Later I found your video and then I tried your code. It perfectly worked. Thanks.
@automateNow10 ай бұрын
You're very welcome. I'm glad it worked!
@azizahasan612010 ай бұрын
why you don't have any video for how to integrate your framework with Jenkins
@automateNow10 ай бұрын
Thanks for your feedback. I'll consider that.
@ismailkart491011 ай бұрын
I wonder that I want to make a group every package and those package has a lot of class level test case and then when we go to this report.html file. can we see every package has test cases under
@IshanDuttagglblord11 ай бұрын
Thanks it worked
@automateNow10 ай бұрын
You're most welcome!
@MotionMotive36011 ай бұрын
Thank you
@automateNow11 ай бұрын
My pleasure!
@nithyasrinivasn982911 ай бұрын
You are life saver and it did worked Subscribed to your channel Thank you so much
@automateNow11 ай бұрын
Happy to help, and welcome to the automateNow community!
@dilawarmr2764 Жыл бұрын
great video, wish to have a playlist to follow for cypress
@automateNow11 ай бұрын
Thank you. I've noted your request.
@dilawarmr276411 ай бұрын
I have a question which is like this, we know how to locate elements, send data, perform actions using Locators in selenium, cypress etc, how can we develop our scripts like to use exceptional handling, conditional statements etc? @@automateNow
@rajitaravur5434 Жыл бұрын
Awesome
@automateNow Жыл бұрын
Thanks for the feedback!
@sachinjoshi5211 Жыл бұрын
Hey great content , the time out works well only when we use cy.get and not when we use cy,xpath , can you show us show to set custom timeout for individual elements .Thanks in advance
@automateNow11 ай бұрын
Thanks for your feedback. Try using an explicit timeout as follows: cy.get('#myElement', { timeout: 10000 }) The timeout is in milliseconds, so use what is appropriate in your scenario.
@sachinjoshi521111 ай бұрын
@@automateNow my question was more around using Cy.xpath . How to specify the timeout while using Cy.xpath
@automateNow11 ай бұрын
You can do something similar as follows: cy.xpath('//your_xpath').should('exist', { timeout: 10000 });
@bharathmarimuthu4575 Жыл бұрын
your tutorial is very helpful, I have the same structure in my framework, and testng.xml contatins parallel =tests; thread-count=x; whenever I increase thread-count to x+10; i see more null pointer/random issues during execution. any thoughts how to fix it?
@automateNow Жыл бұрын
Thanks for your question. It isn't easy to know without looking deeply at the framework. However, here are some general guidelines: Synchronization and Thread Safety: Ensure that shared resources accessed by multiple threads are properly synchronized to avoid race conditions. Use synchronization mechanisms like locks, semaphores, or synchronized blocks/methods to control access. Isolation of State: Make sure each test or thread operates in an isolated state. Avoid sharing state across tests or threads, as this can lead to unexpected behavior. Initialize variables within each test or thread to ensure independence. Proper Exception Handling: Enhance exception handling within your code to catch and log exceptions effectively. When an exception occurs, ensure that it is appropriately handled and does not propagate as a null pointer or undefined behavior. Logging and Debugging: Introduce extensive logging to trace the flow of execution and pinpoint where the null pointer or random issues occur. Use debugging tools to step through the code and identify problematic areas. Review Thread Safety of External Dependencies: Check if any external dependencies (e.g., libraries, frameworks) being used are thread-safe. Incompatible or non-thread-safe dependencies can cause unpredictable behavior in a multi-threaded environment. The bottom line is that you need to be able to determine where the NPEs are coming from to be able to weed out the root cause. Best wishes!
@pjotreknoname1680 Жыл бұрын
Oh please... what about the most important thing SSH key??? :)