0

all button text boxes not in place. This is how it looks like when using the webbrowser. The site in is hewbrew in some parts. For example this ??????????? ???? ????? should be hebrew i think. and you can see the text box on the left with the word text inside and not in place.

Not in places mess

And this is how it should look like when i'm browsing regular in chrome:

In place usig chrome browser

This is the code how i'm navigating to the site and it's all mess:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ap
{
    public partial class Form1 : Form
    {
        bool clickedAdd = false;

        public Form1()
        {
            InitializeComponent();

            webBrowser1.ScriptErrorsSuppressed = true;
            webBrowser2.ScriptErrorsSuppressed = true;
            webBrowser1.DocumentCompleted += WebBrowser1_DocumentCompleted;
        }

        private void WebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
            {
                return;
            }

            HtmlElementCollection items1 = webBrowser1.Document.GetElementsByTagName("span");
            if (clickedAdd == false)
            {
                foreach (HtmlElement item in items1)
                {
                    if (item.GetAttribute("className") == "addMessage")
                    {
                        item.InvokeMember("click");
                        webBrowser2.DocumentCompleted += WebBrowser2_DocumentCompleted;
                        try
                        {
                            clickedAdd = true;
                            webBrowser2.Navigate("test.com");
                            break;
                        }
                        catch (Exception ex)
                        {
                            string myerr = ex.ToString();
                        }
                    }
                }
            }
        }
moshe ralf
  • 489
  • 3
  • 12
  • 21
  • 1
    The WebBrowser control uses the same Internet Explorer version which is installed on your OS in Compatibility Mode. But you can disable Compatibility Mode in Web Browser control. Take a look at [this post](http://stackoverflow.com/a/38514446/3110834) – Reza Aghaei Oct 30 '16 at 10:37
  • It seems the user in [this question](https://stackoverflow.com/questions/34455747/why-when-i-try-to-click-on-a-web-site-button-using-webbrowser-its-not-clicking) is using the same website too and solved the problem in the same way. – Reza Aghaei Oct 30 '16 at 10:43
  • @RezaAghaei I tried now. I'm in the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION, But it didn't help. I added a new value called it as my project name: AutomaticPosting.exe and changed the hex value to 2af9. I see now (11001) i also tried without the exe only AutomaticPosting i also tried to vhost: AutomaticPosting.vhost or AtuomaticPosting.vhost.exe same hex value but didn't help. Could be i'm using windows 10 64bit then the New > DWORD should be 64bit and not 32bit ? – moshe ralf Oct 30 '16 at 11:01
  • 1
    Seems you read the answer but not carefully ;) I get the result using `HKEY_CURRENT_USER`. Also I used `DWORD(32bit)`. Also to get the result in both release and debug mode, use both `yourapp.exe` and `yourapp.vshost.exe`. – Reza Aghaei Oct 30 '16 at 11:13

0 Answers0