Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regarding Location dialogue in CRM app #1382

Open
chandramohand opened this issue Jul 3, 2023 · 15 comments
Open

regarding Location dialogue in CRM app #1382

chandramohand opened this issue Jul 3, 2023 · 15 comments
Labels

Comments

@chandramohand
Copy link

chandramohand commented Jul 3, 2023

My CRM form deals with google maps, when I open the CRM application it opens the location dialogue, how to accept and close that dialogue. Screenshot attached.
testscreenshot

Could anyone please help regarding this.

Thanks in Advance,
Chandra.

@Shakevg
Copy link
Contributor

Shakevg commented Jul 4, 2023

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

@chandramohand
Copy link
Author

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

@chandramohand
Copy link
Author

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,

    };

@Shakevg
Copy link
Contributor

Shakevg commented Jul 6, 2023

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

@AngelRodriguez8008
Copy link
Contributor

AngelRodriguez8008 commented Jul 18, 2023

@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))
            {  
            ...

@chandramohand
Copy link
Author

chandramohand commented Jul 19, 2023

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.

AngelRodriguez8008 added a commit to AngelRodriguez8008/EasyRepro that referenced this issue Jul 20, 2023
Isuue microsoft#958  ->  Add Option TimeFactor
If not use incognito mode, create a Temporal Chrome Profite in to avoid ask for login every time
@AngelRodriguez8008
Copy link
Contributor

AngelRodriguez8008 commented Jul 20, 2023

@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.

@chandramohand
Copy link
Author

chandramohand commented Jul 20, 2023

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.

@AngelRodriguez8008
Copy link
Contributor

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

@chandramohand
Copy link
Author

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.

@chandramohand
Copy link
Author

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

Thanks,
Chandra

@AngelRodriguez8008
Copy link
Contributor

AngelRodriguez8008 commented Jul 29, 2023

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.

@chandramohand
Copy link
Author

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.

@chandramohand
Copy link
Author

chandramohand commented Aug 10, 2023

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.

@chandramohand
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants