Giter VIP home page Giter VIP logo

Comments (15)

Shakevg avatar Shakevg commented on June 9, 2024

chandramohand This option is not supported now by Framework, but you can try extend with the custom solution https://stackoverflow.com/questions/48007699/how-to-allow-or-deny-notification-geo-location-microphone-camera-pop-up

One more option implement custom login and use WinAppDriver to handle dialog

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Thanks @Shakevg, let me try and update you if any issues.

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @Shakevg, I am unable to pass this extra option to the same browser, where I am using the following browser options.
If i declare [ ChromeOptions opt;
opt.AddArgument("--disable-geolocation"); ] I need to pass this new webdriver, where its going to apply for new broswer.
How can I pass this location disable option, to the existing client only?
public static BrowserOptions Options = new BrowserOptions
{
BrowserType = (BrowserType)Enum.Parse(typeof(BrowserType), Type),
PrivateMode = true,
FireEvents = false,
Headless = false,
UserAgent = false,
DefaultThinkTime = 2000,
UCITestMode = true,
CookieСontrolsMode = 0,

    };

from easyrepro.

Shakevg avatar Shakevg commented on June 9, 2024

chandramohand 2 options:

  1. Include library source code to your project and modify the source with a new option
  2. Implement new option in Framework and commit to GitHub

from easyrepro.

AngelRodriguez8008 avatar AngelRodriguez8008 commented on June 9, 2024

@chandramohand
I didn't test it for this argument, but, if you use Chrome, you can use the ExtraChromeArguments Option as follows.

            //1. Global in [ClassInitialize] or [AssemblyInitialize] methods
            TestSettings.SharedOptions.ExtraChromeArguments = new[] { "--disable-geolocation" };
            
            // 2. just for one test
            var options = TestSettings.Options;
            options.ExtraChromeArguments = new[] { "--disable-geolocation" };
            var client = new WebClient(options);
            using (var xrmApp = new XrmApp(client))
            {  
            ...

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Thanks @AngelRodriguez8008, @sharkdevs I am trying to use the second options in my settings where not allowing the ExtraChromeArguments options. Running thise in incognito mode.
protected XrmApp XrmApp
{
get
{
if (_xrmApp == null)
{
var options = TestSettings.Options;
options.ExtraChromeArguments = new[] { "--disable-geolocation" };
var client = new WebClient(options);
_xrmApp = new XrmApp(Client);
}
return _xrmApp;
}
}
I am getting the following error.

Severity Code Description Project File Line Suppression State
Error CS1061 'BrowserOptions' does not contain a definition for 'ExtraChromeArguments' and no accessible extension method 'ExtraChromeArguments' accepting a first argument of type 'BrowserOptions' could be found (are you missing a using directive or an assembly reference?) Ntdt.Tests C:\Users\dast0002\source\repos\test\Ntdt.Tests\Ntdt.Tests.Tests\XrmBinding.cs 41 Active

Option 2: Tried as the following by adding the argument, but still the dialog opens.
Trying to assigning the folloiwng options to client.
var options = TestSettings.Options;
options.ToChrome().AddArgument("--disable-geolocation");

Could you please help me.

Thanks,
Chandra.

from easyrepro.

AngelRodriguez8008 avatar AngelRodriguez8008 commented on June 9, 2024

@chandramohand
Sorry, this logic was implemented just in my fork. I add a Pull Request that support my sample code.
You can download & compile it or wait until the PR get approved.
I also added this particular configuration to a Sample Test Case
options.ExtraChromeArguments = new[] { "--disable-geolocation" };

With the new code, you can also change the SharedOptions initialization in your project in order to enable this configuration for all your tests. Just add this line:
ExtraChromeArguments = new[] { "--disable-geolocation" };
at the end of the follow BrowserOptions constructor call.
TestSettings.SharedOptions, after line 51

The Option 2 as you implemented it will not work. You are getting your own copy of the Options, but this will not be used for the driver later on.

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @AngelRodriguez8008, Thanks for quick response.
Few things just want to check, whether this supports the old chrome browser 101 version? when I ran the lab test its expecting 113 version. Please confirm.

2nd hope this will work fine in private mode.

Thanks and Regards,
Chandra.

from easyrepro.

AngelRodriguez8008 avatar AngelRodriguez8008 commented on June 9, 2024

@chandramohand
you should up- or downgrade the Selenium.WebDriver.ChromeDriver to the desired version.
private mode should not be a problem

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @AngelRodriguez8008,
Applied the changes to my portal but its not working, where the location dialogue opens after login which is required to load the map. I tried both enable and disable, but didnt work.
Thanks,
Chandra.

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @AngelRodriguez8008,
Hope you are doing good. Any update regarding this?

Thanks,
Chandra

from easyrepro.

AngelRodriguez8008 avatar AngelRodriguez8008 commented on June 9, 2024

Hi @chandramohand

The Pull Request is waiting to be reviewed. How I said, you can try to get the new code/branch & compile it for yourself.
In other case, you should wait for some of the repository owners.

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @chandramohand

The Pull Request is waiting to be reviewed. How I said, you can try to get the new code/branch & compile it for yourself. In other case, you should wait for some of the repository owners.

Thanks @AngelRodriguez8008, I got the code for Browseroptions and TestSetting and tried on my CRM app, please refer to the following code. Still after login the dialogue still remains. Here in the CRM app I need to allow the location, where it pulls only those location points. I want to check initally whethere the dialog get closes, later I will try making enable location.
[TestCategory("Labs - TestsBase")]
[TestMethod]
public void NotUsing_TheBaseClass()
{
var options = TestSettings.Options;
options.PrivateMode = true;
options.TimeFactor = 1.5f;
options.ExtraChromeArguments = new[] { "--disable-geolocation" };

        options.UCIPerformanceMode = false; // <= you can also change other settings here, for this tests only

        var client = new WebClient(options);
        using (var xrmApp = new XrmApp(client))
        {
            xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); // Here I am passing my app details
      
            Assert.IsNotNull("Replace this line with your test code");

        }  // Note: that here get the Browser closed, xrmApp get disposed
    }

Thanks and Regards,
Chandra.

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @chandramohand
The Pull Request is waiting to be reviewed. How I said, you can try to get the new code/branch & compile it for yourself. In other case, you should wait for some of the repository owners.

Thanks @AngelRodriguez8008, I got the code for Browseroptions and TestSetting and tried on my CRM app, please refer to the following code. Still after login the dialogue still remains. Here in the CRM app I need to allow the location, where it pulls only those location points. I want to check initally whethere the dialog get closes, later I will try making enable location. [TestCategory("Labs - TestsBase")] [TestMethod] public void NotUsing_TheBaseClass() { var options = TestSettings.Options; options.PrivateMode = true; options.TimeFactor = 1.5f; options.ExtraChromeArguments = new[] { "--disable-geolocation" };

        options.UCIPerformanceMode = false; // <= you can also change other settings here, for this tests only

        var client = new WebClient(options);
        using (var xrmApp = new XrmApp(client))
        {
            xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); // Here I am passing my app details
      
            Assert.IsNotNull("Replace this line with your test code");

        }  // Note: that here get the Browser closed, xrmApp get disposed
    }

Thanks and Regards, Chandra.

Hi @AngelRodriguez8008, I tried with the sample but didnt work, just want to follow up, as I see the pull request is in still Review state, Any update regarding this. Thanks, Chandra.

from easyrepro.

chandramohand avatar chandramohand commented on June 9, 2024

Hi @AngelRodriguez8008, any update of this PR?
Thanks,
Chandra.

from easyrepro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.