Error message

Best practices, code snippets for common functionality, examples, and guidelines.
BeardMJ
Posts: 27
Joined: Wed May 31, 2017 8:39 am

Error message

Post by BeardMJ » Wed May 31, 2017 8:56 am

Hi

I've been building a very straight forward test but all of a sudden when I went to run it I got the following error message:

'XXXXXXModule' does not contain a definition for 'DefaultKeyPressTime' (CS0117)

I'm not sure what this means? On my other modules the same code looks fine. Any help appreciated.

Regards
Martin

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Error message

Post by Vaughan.Douglas » Thu Jun 01, 2017 12:46 pm

In your module you've got the following method
/// <summary>
        /// Performs the playback of actions in this recording.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        [System.CodeDom.Compiler.GeneratedCode("Ranorex", "7.0")]
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.00;

            Init();

        }
The DeffualtKeyPressTime value is set at Keyboard.DefaultKeyPressTime = 100;

So I tried to recreate this issue by removing that line of code outside of the code editor, but rebuilding it in Ranorex just re-adds it. I tried eliminating it from a usercode method and it doesn't throw an error.

Can you provide a few more details.
  • Specifically
  • What version of Ranorex are we dealing with?
  • What typeof module
  • If possible could you provide the ITestModule.Run method for the specific module in question
Doug Vaughan

BeardMJ
Posts: 27
Joined: Wed May 31, 2017 8:39 am

Re: Error message

Post by BeardMJ » Thu Jun 01, 2017 2:37 pm

Hi dude

Thanks for the reply, I simply removed the "Keyboard" module I'm testing and it now works as expected. The module had keyboard used a lot. I.e. variables and screenshots were called keyboard so I wonder if this was causing some confusion for the tool.

I'm running 6.2.1
It was a simple record and reply module I was making. I've now renamed the screenshots etc and it works.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Error message

Post by odklizec » Thu Jun 01, 2017 3:16 pm

Hi,

I think name of the module is the source of your problem. Name of recording/code module cannot use the same name as Ranorex class names. So if you called it "Keyboard" you have the answer ;) Just rename it to something else.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Error message

Post by Vaughan.Douglas » Thu Jun 01, 2017 4:32 pm

BeardMJ wrote:Hi dude

Thanks for the reply, I simply removed the "Keyboard" module I'm testing and it now works as expected. The module had keyboard used a lot. I.e. variables and screenshots were called keyboard so I wonder if this was causing some confusion for the tool.

I'm running 6.2.1
It was a simple record and reply module I was making. I've now renamed the screenshots etc and it works.
That right there would do it! Been there, done similar! :lol:
Doug Vaughan