Click here to Skip to main content
14,921,361 members
Home / Discussions / C#
   

C#

 
GeneralRe: CS1929 Pin
Josh Vanbaalen17-Mar-21 13:40
MemberJosh Vanbaalen17-Mar-21 13:40 
GeneralRe: CS1929 Pin
OriginalGriff17-Mar-21 21:02
mveOriginalGriff17-Mar-21 21:02 
QuestionReading USB Tilt Pin
Luis M. Rojas16-Mar-21 2:48
MemberLuis M. Rojas16-Mar-21 2:48 
AnswerRe: Reading USB Tilt Pin
Pete O'Hanlon16-Mar-21 2:54
mvePete O'Hanlon16-Mar-21 2:54 
GeneralRe: Reading USB Tilt Pin
Luis M. Rojas16-Mar-21 4:06
MemberLuis M. Rojas16-Mar-21 4:06 
AnswerRe: Reading USB Tilt Pin
OriginalGriff16-Mar-21 3:16
mveOriginalGriff16-Mar-21 3:16 
AnswerRe: Reading USB Tilt Pin
Dave Kreskowiak16-Mar-21 3:46
mveDave Kreskowiak16-Mar-21 3:46 
QuestionIs there a way to open firefox driver in mobile emulation mode in selenium c# MSTest Pin
Member 1485915115-Mar-21 19:55
MemberMember 1485915115-Mar-21 19:55 
Currently, I am having difficulty in opening firefox browser in mobile emulation mode in selenium c# with MS Test , can someone please help me in that?

Fifrefox code

private static IWebDriver GetFireFoxDriver(string userAgent)
        {
            var rand = new Random();
            var firefox_options = new FirefoxOptions();
            firefox_options.AddArgument("-private");
            firefox_options.AddArguments("--window-size=1024,768");
            firefox_options.AddArguments("--window-position=0,0");
            firefox_options.AddArgument($"--user-agent= {userAgent}");
            firefox_options.AddArgument("--disable-backgrounding-occluded-windows");
            
                var driver = new FirefoxDriver("C:\\selenium\\firefoxdriver", firefox_options, TimeSpan.FromMinutes(3));
            if (userAgent.Contains("Mobile") == true)
            {
                driver.Manage().Window.Size = new Size(411, 731);
            }
            return driver;

        }


I have done in Chrome Browser - Mobile Emulation


private static IWebDriver GetChromeDriver(string userAgent)
        {
            var options = new ChromeOptions();

            options.AddArgument("incognito");
            options.AddArguments("disable-infobars");

            //Session 0 limit - 1024 x 768
            options.AddArguments("--window-size=1024,768");
            options.AddArguments("--window-position=0,0");
            options.AddArgument($"--user-agent= {userAgent}");
            if (userAgent.Contains("Mobile") == true)
            {
                // Commenting "EnableMobileEmulation" with Device Name - as it overrides the set Driver's userAgent value
                // Added Device Settings to pass userAgent and explicit values of Mobile Device - To avoid captcha block
                var settings = new ChromeMobileEmulationDeviceSettings(userAgent)
                {
                    Height = 731,
                    Width = 411,
                    PixelRatio = 2.6
                };
                options.EnableMobileEmulation(settings);

                //options.EnableMobileEmulation("Pixel 2");
            }
            options.AddArgument("--disable-backgrounding-occluded-windows");

            //options.BinaryLocation = @"C:\Program Files\Google\Chrome\Application\chrome.exe";

            ChromeDriverService service = ChromeDriverService.CreateDefaultService();
            service.SuppressInitialDiagnosticInformation = true;

            var driver = new ChromeDriver(service, options, TimeSpan.FromMinutes(3));
            return driver;
        }

AnswerRe: Is there a way to open firefox driver in mobile emulation mode in selenium c# MSTest Pin
Richard Deeming15-Mar-21 22:37
mveRichard Deeming15-Mar-21 22:37 
QuestionIIS application pool Hangs for Webservice developed in C# Pin
Member 1510093115-Mar-21 10:36
MemberMember 1510093115-Mar-21 10:36 
QuestionExpand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
earnshaw194312-Mar-21 2:55
Memberearnshaw194312-Mar-21 2:55 
AnswerRe: Expand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
OriginalGriff12-Mar-21 4:17
mveOriginalGriff12-Mar-21 4:17 
Question.NET native vs. custom localization Pin
Niemand2510-Mar-21 23:18
professionalNiemand2510-Mar-21 23:18 
AnswerRe: .NET native vs. custom localization Pin
Gerry Schmitz11-Mar-21 7:20
mveGerry Schmitz11-Mar-21 7:20 
AnswerRe: .NET native vs. custom localization Pin
lmoelleb15-Mar-21 22:40
Memberlmoelleb15-Mar-21 22:40 
QuestionContinue program after encountering error Pin
Member 1447460710-Mar-21 10:05
MemberMember 1447460710-Mar-21 10:05 
AnswerRe: Continue program after encountering error Pin
Dave Kreskowiak10-Mar-21 10:14
mveDave Kreskowiak10-Mar-21 10:14 
GeneralRe: Continue program after encountering error Pin
Member 1447460710-Mar-21 10:35
MemberMember 1447460710-Mar-21 10:35 
GeneralRe: Continue program after encountering error Pin
Dave Kreskowiak10-Mar-21 11:05
mveDave Kreskowiak10-Mar-21 11:05 
GeneralRe: Continue program after encountering error Pin
Gerry Schmitz11-Mar-21 7:23
mveGerry Schmitz11-Mar-21 7:23 
AnswerRe: Continue program after encountering error Pin
NotTodayYo10-Mar-21 10:52
MemberNotTodayYo10-Mar-21 10:52 
AnswerRe: Continue program after encountering error Pin
Eddy Vluggen10-Mar-21 11:24
professionalEddy Vluggen10-Mar-21 11:24 
AnswerRe: Continue program after encountering error Pin
OriginalGriff10-Mar-21 21:17
mveOriginalGriff10-Mar-21 21:17 
QuestionHow to pass an array or structs to DeviceIoControl when using pinvoke Pin
BobZscharnagk7-Mar-21 22:13
MemberBobZscharnagk7-Mar-21 22:13 
AnswerRe: How to pass an array or structs to DeviceIoControl when using pinvoke Pin
Randor 8-Mar-21 11:50
professional Randor 8-Mar-21 11:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.