[Playwright]Is there any way to turn “Chrome automated test”off? I'm afraid the website detected this and blocked me - chromium

[Playwright]Is there any way to turn “Chrome automated test”off? I'm afraid the website detected this and blocked me.
I’m using playwright.chromium.launch_persistent_context()
This is what I want to disable.By the way,I found that when I useplaywright.chromium.launch(),there won‘t be this title anymore but I want non incognito instead of incognito

You can try to use Chromium, or add options to disable infobar
https://playwright.dev/docs/api/class-browsertype
options.args("disable-infobars");

Related

Disable smooth scroll Firefox-Selenium

I want to disable Smooth Scrolling of any page for testing purposes for firefox, I want the exact same behavior as this --disable-smooth-scrolling=true chrome's argument. With that argument, chrome basically does the scrollIntoView() instant, instead of auto.
Why do I want to disable it? Well because selenium-w3c is not waiting long enough for the animation to finish, causing ElementNotInteractableException or ClickInterceptedException.
I tried disabling a bunch of preferences, including all the settings that have "smoothScroll" in it, but no luck so far. No preference I change seems to affect firefox in any way. I have a lot of workarounds for this, but the best solution would be to disable it entirely.
Edit:
RESOLVED, I created a simple add on to override scroll-behavior from CSS.

Firefox - hide browser frame with Selenium

I'm trying to figure out how to hide the border (including the address bar, tabs, title bar... everything that isn't the browser viewport) of my Firefox instance instantiated by Selenium.
If there's some way to have it use a userChrome.css, that would be straightforward enough. I've tried loading a profile folder that included a userChrome.css using this answer as a guide, but it seemed to ignore the styles. I've also looked through Firefox's about:config to see if there's some preference that would hide the frame of the window, but I haven't found anything yet.
Any solution that allows me to hide all or some of these elements when creating the instance with Selenium would be helpful. I know it's silly, but that's how it goes sometimes, you know?
-edit-
I don't think the title bar needs to be hidden. But everything else should be hidden.
-another edit to clarify a few things-
I mentioned kiosk mode in the comments as an example of the sort of thing I'm going for. Kiosk mode isn't exactly what I'm looking for, though. The windows aren't meant to be fullscreen, but they should still lack the elements of a common browser window. Think of it as like an Electron app. Out of the box, Electron lacks an address bar, tabs, etc. That's basically what we have for our app, but it's with regular-old Firefox. Again, whether these elements are displayed or not doesn't typically impact the test, but we want them hidden anyway.
Finally, I a friend of mine tried achieving this goal using a userChrome.css wrapped in a Firefox profile and was able to get Selenium to use the userChrome. So perhaps I need to figure out what I'm doing wrong. The biggest difference between how he did it and how I'm doing it is I must use a remote web driver for testing. But even still, it should be able to load the userChrome.css file. I'll try to update this question with more details as I fiddle with it some more.
-edit-
I think the reason userChrome isn't working when specifying a profile is because of the version(s) of Selenium/Geckodriver/Firefox being used.
The geckodriver version I started with was 0.15. 0.17 behaved exactly the same. 0.18 didn't respect the profile I passed along to it at all and instead had Firefox open the profile selection window (not very useful, but I was able to at least select the correct profile and see the userChrome.css get applied). 0.24 is no different.
Firefox is 52.9.0. Not much I can do about that.
We're using selenium (standalone) server 3.8.1. Switching out for 3.141.59 Didn't change anything.
Unless there's a version combination that will work with Firefox 52, I think the only thing I can do is wait until there's an update.
At last I have figured it out. In order to get Selenium to use my custom profile, I needed to do the following:
FirefoxProfile profile = new FirefoxProfile(new File(path_to_profile));
FirefoxOptions options = new FirefoxOptions().setProfile(profile);
RemoteWebDriver driver = new RemoteWebDriver(options.toCapabilities());
driver.get(url_of_webpage);
Thanks to avinesh09 on Github for the info I needed to solve the problem. It's so simple, but this has to be the only way that I neglected to try to load the profile.
If fullscreen (kiosk) mode is what you ask for (as then all you see is the viewport) it is as simple as:
driver.manage().window().fullscreen();
It is the same user experience as pressing "F11" in your browser.

Capybara Selenium Navigate To URL Hangs With Popup Alert on Safari

At the end of my tests Capybara automatically navigates to "about:blank" in order to set up the next test. Sometimes the application I'm testing will throw a popup alert if the user leaves the page (which is expected). I have some code to handle this:
begin
page.driver.browser.navigate.to("about:blank")
page.driver.browser.switch_to.alert.accept
rescue Selenium::WebDriver::Error::NoAlertPresentError
# No alert was present. Don't need to do anything
end
This works fine on Firefox, Chrome, and IE. But for some reason on Safari the navigate command hangs, I assume because of the popup. Anyone know a workaround for this?
There is no simple workaround for this at this time in any version of Selenium language bindings. It is a known issue the Selenium team is not interested in resolving. Fundamentally, it is due to the architecture of Safari and consequently the architecture of the Safari Driver.
The JavaScript of the Safari Driver extension does not know about most of the alerts and popups and dialogs that appear as modal Cocoa layer windows.
It also cannot interact with them.
There is a way but it won't be easy and nobody's done it.
You would need to use Cocoa.
So you would want to use RubyCocoa in this case.
(or PyObjC if you used Python)
You would then possibly also want a sidecar app actually written in Objective-C.
The trick would be to use the AX (Accessibility API) and a separate process to observe if there is an alert as the front window and poke at its labels and buttons' text as visible to the AX APIs.
AX APIs are probably exposed in RubyCocoa via the ScriptingBridge.
However, you would need to add your 'app' to the Security preference pane's list of things allowed to control the computer.
With that, you could detect the window and handle it.
It could be fairly brittle across web sites, but if built well, you could handle expected conditions.
You could try to confirm like this which I believe should work across browsers
# click ok to confirm
page.evaluate_script('window.confirm = function() { return true; }')

Auto suggest/complete not loading in webdriver browser instances

I'm having a little trouble nailing down what's causing a particular issue. I'm fairly new to automation testing and I'm having a strange problem. The website I'm testing has an auto suggest function which works absolutely fine when checking manually. The problem is when loading a browser using the Selenium webdriver (I've tried firefox, chrome and IE drivers) that the auto suggest is simply not loading.
It's like the part of the page to do with that and a date/time mini popup aren't loading at all so none of them work when running scripts. Has anyone else had this and resolved it? or is it an issue with the web page itself?
Thanks
You may need to fire an event which by default webdriver is not envoking with sendKeys.
Asking you developer how it works in their code, and then extend selenium to replicate this behaviour.
Also, have you tried do sendKeys one character at a time with a small sleep in-between

MaintainScrollPositionOnPostback Does Not Work In Firefox 4.0 [duplicate]

I am using VS 2008. I like the feature maintainscrollpositiononpostback. It works fine with IE 8. But it does not work consistently with Firefox. Sometimes, instead the line I click on goes to the bottom of the page. The field I am trying to refresh is with a div tag with overflow set to auto. Also I have several update panels with updatemode set to conditional. This means only the panel affected should be refreshed. This is also not working in the case on Firefox.
I have searched the web for possible solutions but none of them work for me.
Most of my users use Firefox so this is a problem for me.
Thanks in advance,
Bob
scrollsaver to the rescue?
http://en.hasheminezhad.com/scrollsaver
I found this little js file a few weeks ago after implementing Post/Redirect/Get on a few of my pages. It may enable you to turn off maintain on your pages if you throw it in the master. I haven't fully tested it with ff4/5 or chrome...
Edit the Browser Capabilities file, and explicitly set it so that MaintainScrollPositionOnPostback is supported on Safari Browsers.
you can use javascript for this.. chek it out..
http://weblogs.asp.net/andrewfrederick/archive/2008/03/04/maintain-scroll-position-after-asynchronous-postback.aspx