I use Selenium for a study project, to scroll Amazon Webpage and save items in result, price, ...
My code works, I can get all items link in the page, and then get data about its.
But my issue is that when I refresh the page, I could not see new items which appears in result (visible for any other browser). Selenium can't see it until I go to Chromedriver. When I goes to ChromeDriver (so when it become active windows?) and scroll down on the webpage, then Selenium could see the new item in the list send by Amazon.
To try to avoid this, I change between several page of Amazon, but when I comeback to the wanted page, new items are not visible.
driver.Navigate().GoToUrl(url);
I also try refresh and scroll down without success.
driver.Navigate().Refresh();
driver.Keyboard.PressKey(Keys.PageDown);
I'm not sure if it's because the chromedriver is not the active windows (but if I have to set it as active windows I can't have several windows in the same time, and can't work on my computer at the same time). If I stop ChromeDriver and restart it, he saw new items in the result. Do you think it's link to javascript use by Amazon?
Thanks for your help / ideas.
Related
This bounty has ended. Answers to this question are eligible for a +50 reputation bounty. Bounty grace period ends in 3 hours.
Onur Topal wants to draw more attention to this question:
for some reason, selenium does not show the browser but looks like working fine. I can hear the audio it is playing and can retrieve HTML elements from driver and execute scripts.
I am using the below code to open a selenium driver with Chrome.
The first problem is --allow-file-access-from-files flag is not working at all either with debug mode or release mode.
Also, the main problem is when I publish my code with release mode and deploy another machine (Win 10 Pro) the app does not show the browser.
Edit: I think this is not clear selenium working fine but is hidden in some cases we need to display it for user input.
I also have an issue to play audio files automatically and the solutions I found on the internet are not working as well. Throwing JS error saying no click detected.
Is there a way to open a browser with full control? another browser for example firefox etc.
public static IWebDriver GetHeadless()
{
ChromeOptions cOptions = new ChromeOptions();
cOptions.AddArgument("user-agent=SeleniumTests");
cOptions.AddArgument("--allow-file-access-from-files");
//cOptions.AddArgument("--headless");
return new ChromeDriver(cOptions);
}
Thanks
Google chrome automatically updated to Version 78.0.3904.87 yesterday and i now seem to have a problem with Selenium Webdriver.
When i run my tests in Visual Studio, the click events seem to occur but the expected result on screen does not happen e.g. clicking a link passes through the code (link.Click) successfully with no failure but the link does not get clicked on screen.
When i run the same test in Debug mode and Step Into each section of code it works fine, its as if selenium is running too fast for the browser (i have an implicit wait built in but its irrelevant, the element is there its just not clicking properly). I'm also finding things like sendKeys does not populate the field though it passes through the code successfully, again fine when stepping into it in Debug mode.
I've tried updating my Chromedriver to the version for V78 but this has made no difference
Similar problem here but my issue is not restricted to pdfs only
Chromedriver 78 cant find element in pdf
My team is running into the same issue. The issue seems to be the time between our WebDriverWaits and our Clicks -- the waits seem to be passing through instantaneously in cases they should not and then any Click element call (or action) hovers over what we want to click on but doesn't actually click.
I finally got to the bottom of this with our setup and it turned out to be the --enable-automation flag that seemed to be causing page flickering on page load.
After adding excludeSwitches: ['enable-automation'] to my config it has resolved the issue.
I want to test reactJS App with coded UI and play it back with Chrome browser. I'm recording my actions on IE, I have all selenium components and browser drivers installed, my chrome version is latest(tried older versions too). Scenario of my test is to type both login and password, log in then log out. So when i run my test on IE everything works perfectly. But if i run it on Chrome it types everything logs in, so when its on the main page with loads of components it wouldn't find log out button, saying it couldn't find controls with given info(tags, ids, classes). But when i inspect element with the info from test it matches perfectly.
Never mind folks, Solved the issue. Turns out Chrome doesn't wait for all components to load unlike IE. So as long as it clicked on login button it was going to search for that component not even waiting for page to load. So I just set some conditions telling to wait until everything loaded then try to look for components.
I am trying to use Selenium to automate the use of a web service.
Whenever I try to click on elements within the web page using Selenium the result is strange, it seems as if the web page is able to detect whenever I click using Selenium.
Whenever I click using my cursor the web page functions normally even if I set a break point mid application and start clicking it works fine.
Is there any alternative in .NET or Python that I could use to automate clicks in a similar fashion or perhaps avoid detection of these clicks on the service?
action.MoveToElement(element, 158, 208).Click().Build().Perform();
Thread.Sleep(5000);
for (int i = 0; i < 5; i++)
{
action.MoveToElement(element, 258, 158).Click().Build().Perform();
Thread.Sleep(2000);
action.MoveToElement(element, 228, 158).Click().Build().Perform();
//var screenshot = new Screenshot();
//screenshot.CaptureScreen(Convert.ToString(i + 1) + ".png");
Thread.Sleep(2000);
}
The service is an image service, whenever I click done to confirm that image has been processed, it will keep the image visible rather than making it disappear but when I interrupt and click it myself, it will disappear. The reason this is bad is the visible image will overlay the new image, the selenium clicked image will stay visible and manual clicks will not.
I am using the latest version of ChromeDriver and Selenium however I have tried Mozilla & IE with and other versions of selenium and web drivers with no avail.
The idea of putting CAPTCHA on a site is exactly to tell machines and people apart, so
seems as if the web page is able to detect whenever I click using Selenium
is working as designed. For simple captcha you can call some free ocr.space online OCR service. This will work just fine as long is an image with a text. You can also try Google Cloud Vision OCR which works equally well, but it is a bit more complicated to set up.
I'm developing an addon for IE8+.
Main function:
- when I click the toolbar, it will display a box inside every single page, ex: google.com, bing.com, codeproject.com... by using execScript to execute jQuery.
Therefore, what Im doing is run javascript in the current page.
Everything has done except when that page perform an Pop-up, it doesnt work anymore.
I click the toolbar, nothing happen, but when I look at the pop-up, surprise! has the box which im trying to display. So, I think the current tab and the popup of its is running the same process.
I have change registry key TabProcGrowth to 20, to make sure every single tab run by its own process, but maybe it not work with popup.
sr for my bad english, any suggestion is welcome.
Thanks in advance.
update:
I have changed the way to develop my addon, so I change my question, too. (But any suggestion for the 1st question still very useful for me).
My new question still mention the "execScript" problem.
HOW to execute javascript with every individual tab of IE browser with TabProcGrowth = 0. I need this value set to 0 because I have the timer to request to the server every interval1 (ex: 60s). So if there are more than one processes of IE, the addon will send multi request to server at the sametime.
In my situation now, I set TabProcGrowth to 0. Open IE, open some tabs. Click the toolbar at the newest tab, it works, ofcourse!. But when I click toolbar at the old one, nothing happen. The script still be execute but it takes effect on the newest tab.
It's the big problem for me, resolve this problem, you guys save my life.