Get updated tags of html in chromeDriver using selenium after click in C# - selenium

Working on Selenium automation testing after a click on button <ViewStatement> webpage gets updated with pdf link and some other tags but it is not updating into ChromeDriver driver object
I already tried like PageSource & hit same url into another ChromeDriver driver1 but still not working.
link - https://mfs.kfintech.com/
Code -
driver.FindElement(By.XPath("//input[#value='View Statement']")).Click();
before this click the page is completely loaded into the driver but after click page doesn't reloaded but still some tags are inserted into the same page with same link before and after click so i want whole page after click.
ViewStatement does not exist on link page after login it is there.

Related

Selenium: Page JS not running, stuck in load

Running a scraper on a site and the js doesn't seem to be working. Stuck on "loading" on the page but the rest of the html is loading fine.
Screen shot of load.
https://i.stack.imgur.com/0WofB.png
from selenium import webdriver
bin_path = ''#path to local bin file for driver
driver = webdriver.Chrome(executable_path=bin_path,desired_capabilities={'javascriptEnabled': True})
driver.get(URL)
Not sure if I need to pull the name of each script and execute it one at a time?

How to make inspect window active using selenium python?

I am trying to automate a plugin in chrome browser. It requires opening an inspect window and perform operation on inspect window. I am able to open inspect window using robot class and navigate among inspect GUI elements but cannot do HTML DOM operation in inspect window. Inspect window contains iframes but I am not able to switch to those iframes from main page. When I try to list the iframes on a active page it only shows iframes from the main page not from the inspect window. I want to switch to inspect window using iframes or any other way if there is any. The code I have written so far is
from pyrobot import Robot
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Chrome()
browser.get('https://chrome.google.com/webstore/detail/dynamic-assessment-plugin/fnapgcgphlfhecijolobjodbbnjjpdga')
browser.maximize_window()
browser.implicitly_wait(15)
browser.find_element_by_css_selector("[aria-label='Add to Chrome']").click()
time.sleep(3)
robot = Robot()
robot.addExtension() # customized Robot class to add extension
robot.newtab() # customized Robto class for new tab
browser.switch_to.window(browser.window_handles[1])
browser.get('http://www.walmart.com')
time.sleep(8)
robot.inspectElement() # Customized Robot class for inspecting (Ctrl+shift+i)
While you create chromedriver object in C# this will work,
you need to provide profile by adding arguments in chromeoptions,
ChromeOptions options = new ChromeOptions();
options.AddArguments("--auto-open-devtools-for-tabs");
browser = new ChromeDriver(DrivePath, options, TimeSpan.FromSeconds(100));
You can also try to press F12 it will open inspect window
then you can use Robot class or Windows. Forms library for automation scripts manae multiple window Forms.
Your code is in python same answers are alredy provided for java and C#.
You can also refer more at:
How to open Chrome Developer console in Selenium WebDriver using JAVA
How do you automatically open the Chrome Devtools tab within Selenium (C#)?

Different test outcome depend on browser - selenide selenium

I have number of tests in the juint test class, By using maven environment with Selenide version 3.5.1.
for these tests, browser wil be only opened for the first test and closed at the last test.
I tried to run them using chrome & firefox browsers:
Chrome: all test are run successfully
Firefox: there are some tests are failed, and I feel it was randomly failed.
For each test, I need to click on button where a pop-box will appear.
for chrome: each test the pop-box appeared when the button was clicked
for firefox: randomly the pop-box didn't appear when the button was clicked.
I don't know what is the problem reason!
Have you try to add a temporisation, to wait the pop-up ?
May be in Firefox, the pop-up is slower and your test is going to fast. Because of this your test is looking for an element that isn't already present.
Try something like this
WebDriverWait waitLog = new WebDriverWait(driver, 2);
waitLog.until(ExpectedConditions.elementToBeClickable(By.id("b")));
OR
WebDriverWait waitLog = new WebDriverWait(driver, 2);
waitLog.Until(ExpectedConditions.ElementIsVisible(By.id("b")));

How to deal with Java warning popup?

While running WebDriver automation scripts I came across a situation where it is trying to open a page which contain one segment with live camera (Made with Java applet). Once script reaches to this page - a Security Warning alert (with allow and not allow) shows up and blocks the execution process. Is this something that anyone faced before - actually I am looking for an option to block this security warning to get displayed on the page.
A popup is coming where i want to click on the "Allow". How to move the focus to the new popup window and click on Allow.
Can anyone please help me for the above problem?
I was having problems accepting the java applet "Allow"
My solution was to create a firefox profile that had the settings to always activate the plugin:
FirefoxProfile fp = new FirefoxProfile();
fp.setAcceptUntrustedCertificates( true );
fp.setPreference( "security.enable_java", true );
fp.setPreference( "plugin.state.java", 2 );
WebDriver d = new FirefoxDriver( fp );
Where plugin.state.java:
plugin.state.java = 0 --> never activate
plugin.state.java = 1 --> ask to activate
plugin.state.java = 2 --> always activate
This might get you closer...
Selenium uses a different firefox profile because Java was inactive for me and I did not have my firebug plugin in the Firefox browser Selenium launched. I would have to open another Firefox to use Firebug.
I found my default Firefox profile by searching %appdata% in the start menu then clicking on Roaming/ Mozilla/ Firefox/ Profile/ and then it gave my default profile name.
You can also open the firefox help menu (? logo) & click troubleshoot info... click Show Profile Folder
I then configured selenium to use my default profile so Java was enabled and Firebug was available in the browser Selenium launched:
Make sure that you use "/" in selenium even though it may use "\" in the windows path location
fp = webdriver.FirefoxProfile('C:/Users/xxx/AppData/Roaming/Mozilla/Firefox/Profiles/41s7nq9o.default')
driver = webdriver.Firefox(fp)
driver.get('www.stackoverflow.com')
where 41s7nq9o.default is the name of your default profile

Javascript window.open(xxx, "download") creates a blank page while download prompt

When I run window.open(file, "download") with safari, it opens a blank page while download prompt and the blank page stays there. I notice firefox opens a blank tab but it's close when download starts. Is there another javascript command/function that will work so there's no blank page opened in Safari?
Why don't you use window.location = file instead?
Redirecting to the file leads to the same behavior as clicking on a link to that file: you get the download prompt, and the browser stays on the current page!
Call window.open like this (it works in all major browsers):
window.open(file, '_parent', 'download');